vendredi 29 août 2014

What main(++i) will return in C


Vote count:

0




i have a program like this.



‪#include<stdio.h>
#include<stdlib.h>
int main(int i) { /*i will start from value 1 i think */
if(i<10)
printf("\n%d",main(++i)); /* printing the values until i becomes 9 */
}

output :
5
2
2
2
Can anyone explain how the output is coming ?? what main(++i) is returning for each iteration.


Also it is producing output 5111 if i remove the \n in the printf function. Thanks in advance.



asked 25 secs ago







What main(++i) will return in C

Aucun commentaire:

Enregistrer un commentaire