Answers for "how to set up a return function in c++"

C++
21

how to declare a function in c++

// function example
#include <iostream>
using namespace std;

int addition (int a, int b)
{
  int r;
  r=a+b;
  return r;
}
Posted by: Guest on March-04-2020
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

Code answers related to "how to set up a return function in c++"

Browse Popular Code Answers by Language