Skip to content

Instantly share code, notes, and snippets.

@rkwitt
Created October 24, 2016 12:05
Show Gist options
  • Save rkwitt/47be6f23f534d3c48287725b93ce2446 to your computer and use it in GitHub Desktop.
Save rkwitt/47be6f23f534d3c48287725b93ce2446 to your computer and use it in GitHub Desktop.
Simple example to demonstrate recursion and stack build up and tear down
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