Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save matthewflanneryaustralia/da6a39777ecee5d1c602bad39ba833e0 to your computer and use it in GitHub Desktop.
Save matthewflanneryaustralia/da6a39777ecee5d1c602bad39ba833e0 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
// function declaration
int max(int num1, int num2);
int main ()
{
// local variable declaration:
int a = 100;
int b = 200;
int ret;
// calling a function to get max value.
ret = max(a, b);
cout << "Max value is : " << ret << endl;
return 0;
}
// function returning the max between two numbers
int max(int num1, int num2)
{
// local variable declaration
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment