c++ get functions return code example
Example 1: return function in cpp
void printChars(char c, int count) {
for (int i=0; i<count; i++) {
cout << c;
}//end for
return; // Optional because it's a void function
}//end printChars
Example 2: return function in cpp
// Multiple return statements often increase complexity.
int max(int a, int b) {
if (a > b) {
return a;
} else {
return b;
}
}//end max