- #1
transgalactic
- 1,395
- 0
when i compile it i get perfectly well output
without any endless recursion
but when i trace this code:
it will always call a again and again there is no end to this recurtion
??
without any endless recursion
but when i trace this code:
Code:
#include <stdio.h>
int a(int n,int count){
int i;
for(i=0;i<n;i++)
count =a(i,count); <<<<<<<<<<the problematic line
return count+1;
}
int b(int n,int count) {
int i;
count =a(n,count);
for(i=0;i<n;i++)
count =b(i,count);
return count;
}
int main (){
int i;
for (i=0;i<4;i++)
printf("%d",a(i,0));
printf("\n%d\n",a(i,10));
for (i=0;i<4;i++)
printf("%d",b(i,0));
printf("\n%d\n",b(i,10));
return 0;
}
Code:
Main:
for (i=0;i<4;i++) i=0
printf("%d",a(0,0));
a:
n=0 count=0
int a(0,0){
for(i=0;i<n;i++)
count =a(i,count); a=0 count=0
??