I really need help learning how to get the output of this program.. I'm not completely lost but I need it in the simplest terms. I have a test soon and I'm trying to study.
Code:
/*Recursive Trace
Written by Ron
April 2006
*/
#include <stdio.h>
int barph(int a[5], int upchuck);
int main(void)
{int a[5]={11, 13, 15, 17, 19};
int krud;
krud=0;
krud=krud*barph(a,3);
printf("final result is %d\n", krud);
return 0;
}
int barph(int a[5], int upchuck)
{int sick;
sick=1;
if (upchuck>1)
sick=a[upchuck]+barph(a,upchuck-1)+3;
printf("upchuck is %d, sick is %d\n", upchuck, sick);
return(sick);
}
It prints out:
upchuck is 1, sick is 1
upchuck is 2, sick is 19
upchuck is 3, sick is 39
final result is 0