Created
October 24, 2016 12:05
-
-
Save rkwitt/47be6f23f534d3c48287725b93ce2446 to your computer and use it in GitHub Desktop.
Simple example to demonstrate recursion and stack build up and tear down
This file contains 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
int g(int x, int y) { | |
if (y > 0) | |
return g(x, y - 1) + 1 ; | |
else | |
return x; | |
} | |
int main() { | |
int a; | |
a = g(1,2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment