void main()

{

static int i=5;

if(--i){

main();

printf("%d ",i);

}

}



void main() { static int i=5; if(--i){ main(); printf("%d ",i); }..

Answer / susie

Answer :

0 0 0 0

Explanation:

The variable "I" is declared as static, hence memory for I
will be allocated for only once, as it encounters the
statement. The function main() will be called recursively
unless I becomes equal to 0, and since main() is recursively
called, so the value of static I ie., 0 will be printed
every time the control is returned.

Is This Answer Correct ?    4 Yes 5 No

Post New Answer

More C Code Interview Questions

Write a c program to search an element in an array using recursion

1 Answers   Wipro,


What is the hidden bug with the following statement? assert(val++ != 0);

1 Answers  


main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); }

2 Answers  


Program to Delete an element from a doubly linked list.

4 Answers   College School Exams Tests, Infosys,


void main() { int const * p=5; printf("%d",++(*p)); }

3 Answers   Infosys, Made Easy, State Bank Of India SBI,






what is oop?

3 Answers  


To reverse an entire text file into another text file.... get d file names in cmd line

0 Answers   Subex,


void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }

1 Answers  


main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?

2 Answers  


main() { int c = 5; printf("%d", main||c); } a. 1 b. 5 c. 0 d. none of the above

2 Answers   HCL,


Which one is taking more time and why ? :/home/amaresh/Testing# cat time.c //#include <stdio.h> #define EOF -1 int main() { register int c; while ((c = getchar()) != EOF) { putchar(c); } return 0; } ------------------- WIth stdio.h:- :/home/amaresh/Testing# time ./time_header hi hi hru? hru? real 0 m4.202s user 0 m0.000s sys 0 m0.004s ------------------ Witout stdio.h and with #define EOF -1 =================== /home/amaresh/Testing# time ./time_EOF hi hi hru? hru? real 0 m4.805s user 0 m0.004s sys 0 m0.004s -- From above two case , why 2nd case is taking more time ?

0 Answers  


Program to find the largest sum of contiguous integers in the array. O(n)

11 Answers  


Categories