C Programming - Command Line Arguments - Discussion

Discussion Forum : Command Line Arguments - Find Output of Program (Q.No. 5)
5.
What will be the output of the program
#include<stdio.h>
void fun(int);

int main(int argc)
{
    printf("%d ", argc);
    fun(argc);
    return 0;
}
void fun(int i)
{
    if(i!=4)
        main(++i);
}
1 2 3
1 2 3 4
2 3 4
1
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
28 comments Page 3 of 3.

Merlin said:   1 decade ago
Thanks sreepal, your explanation is easy to understand.

Jhunu said:   1 decade ago
Thanks sreepal.

Anurag Kumar said:   1 decade ago
I am using turbo c++ , i compiled and execute same program but always showing error that "can't call main within the program in fun(int) unction

Divya said:   1 decade ago
Thanks sreepal:) very nice explanation

Aseem said:   1 decade ago
Thanks for this "cool" explanation :-)

Arvind kumar said:   1 decade ago
Please explain it again to make more clear it. !

Sravan said:   1 decade ago
It is a nice explanation.

Moshii said:   1 decade ago
Thanks sreepal for your great ans.


Post your comments here:

Your comments will be displayed after verification.