Skip to content

Instantly share code, notes, and snippets.

@kuntalchandra
Last active December 3, 2019 12:50
Show Gist options
  • Save kuntalchandra/ac583ac9d9965642ccdc009b7c45e86a to your computer and use it in GitHub Desktop.
Save kuntalchandra/ac583ac9d9965642ccdc009b7c45e86a to your computer and use it in GitHub Desktop.
How does recursion work. Guess the output :)
#include <stdio.h>
void print_recursive(int n);
int main() {
print_recursive(7);
}
void print_recursive(int n) {
if (n <= 0) {
return;
} else {
n--;
}
print_recursive(n);
printf("n is: %d\n", n);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment