Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void rec(int x)
- {
- if(x>0)
- rec(x--);
- printf("%d",x);
- }
- int main()
- {
- rec(4);
- _getch();
- } /*This doesn't work. And shows a stackoverflow */
- void rec(int x)
- {
- if(x>0)
- rec(--x);
- printf("%d",x);
- }
- int main()
- {
- rec(4);
- _getch();
- } /*This gives a proper output as expected*/
- /*The output is 00123*/
- void rec(int x) {
- if (x>0)
- rec(x--);
- printf("%d",x);
- }
- int a, b;
- a = b = 1;
- printf("--a: %d b--: %dn", --a, b--); // Output is --a: 0 b--: 1
Add Comment
Please, Sign In to add comment