Created
September 29, 2016 09:07
-
-
Save matthewflanneryaustralia/da6a39777ecee5d1c602bad39ba833e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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