Quantcast
Browsing all 3 articles
Browse latest View live

Answer by Guffa for Recursive a+b function

"I also want to understand how stacking happens in this case for variables cnt and x. Are they stacking in pairs like 0-9, 1-10 ,2-11,3-12 ,4-13"No, the value from cnt is not on the stack at all. It's...

View Article


Answer by Lstor for Recursive a+b function

First of all, main should be declared int main.Second, I would advise passing the cnt (which I have called iteration_number) as a parameter as well. Also, you should avoid using a global (b). If you...

View Article


Recursive a+b function

I am practising recursion and have written the small code for summing a+b as below:#include <stdio.h>int b=6;static int cnt;void main(void){ int a=9,sum; sum=succ(a); printf("Sum returned :...

View Article
Browsing all 3 articles
Browse latest View live