Recursively

Aug 19, 2007 0 Replies

Hi,



Need some clarification regarding the following example w.r.t recursive .


void f(char *) ; main() { f("123"); } void f(char a[]) { if(a[1]=='\0') return; f(a+1); f(a+1); printf("%c", a[1]); }



The output for this program has been stated as 332. How is it possible ?



It should actually return without printing anything. How can one get '332' as output ?



Thx in advans, Karthik Balaguru



Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required