Output of following program?
#include <stdio.h>
int main()
{
static int i=5;
if(--i){
main();
printf("%d ",i);
}
}
Answers
Answered by
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
0
ɿᵑᵖᶷᵗ
#include <stdio.h>
int main()
{
static int i=5;
if(--i){
main();
printf("%d ",i);
}
}
øᶷᵗᵖᵘᵗ
...0 0 0 0
Similar questions