Social Sciences, asked by Mohit0000, 11 months ago

Output of following program?

#include <stdio.h>

int main()

{

    static int i=5;

    if(--i){

        main();

        printf("%d ",i);

    }

}

Answers

Answered by GhaintMunda45
3

Code

Input

#include <stdio.h>

int main()

{

    static int i=5;

    if(--i){

        main();

        printf("%d ",i);

    }

}

Output

0 0 0 0

Explanation :

A static variable is shared among all calls of a function. All calls to main() in the given program share the same i. i becomes 0 before the printf() statement in all calls to main().

Answered by Anonymous
0

ɿᵑᵖᶷᵗ

#include <stdio.h>

int main()

{

    static int i=5;

    if(--i){

        main();

        printf("%d ",i);

    }

}

ø

...0 0 0 0

Similar questions