Answers for "c++ function return a function"

C++
0

return function in cpp

// Single return at end often improves readability.
int max(int a, int b) {
    int maxval;
    if (a > b) {
        maxval = a;
    } else {
        maxval = b;
    }
    return maxval;
}//end max
Posted by: Guest on June-27-2020
-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
Posted by: Guest on June-27-2020

Browse Popular Code Answers by Language