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

main() { struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

1 Answers  


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

1 Answers  


void main() { while(1){ if(printf("%d",printf("%d"))) break; else continue; } }

1 Answers  


main() { int i = 3; for (;i++=0;) printf(“%d”,i); }

1 Answers   CSC,


main() { struct date; struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

1 Answers  






main() { int x=5; for(;x!=0;x--) { printf("x=%d\n", x--); } } a. 5, 4, 3, 2,1 b. 4, 3, 2, 1, 0 c. 5, 3, 1 d. none of the above

2 Answers   HCL,


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

0 Answers  


main( ) { int a[ ] = {10,20,30,40,50},j,*p; for(j=0; j<5; j++) { printf(“%d” ,*a); a++; } p = a; for(j=0; j<5; j++) { printf(“%d ” ,*p); p++; } }

1 Answers  


#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }

2 Answers  


What are segment and offset addresses?

2 Answers   Infosys,


void pascal f(int i,int j,int k) { printf(“%d %d %d”,i, j, k); } void cdecl f(int i,int j,int k) { printf(“%d %d %d”,i, j, k); } main() { int i=10; f(i++,i++,i++); printf(" %d\n",i); i=10; f(i++,i++,i++); printf(" %d",i); }

1 Answers  


why the range of an unsigned integer is double almost than the signed integer.

1 Answers  


Categories