int i=10;

main()

{

extern int i;

{

int i=20;

{

const volatile unsigned i=30;

printf("%d",i);

}

printf("%d",i);

}

printf("%d",i);

}



int i=10; main() { extern int i; { int i=20; { con..

Answer / susie

Answer :

30,20,10

Explanation:

'{' introduces new block and thus new scope. In the
innermost block i is declared as,

const volatile unsigned

which is a valid declaration. i is assumed of type int. So
printf prints 30. In the next block, i has value 20 and so
printf prints 20. In the outermost block, i is declared as
extern, so no storage space is allocated for it. After
compilation is over the linker resolves it to global
variable i (since it is the only variable visible there). So
it prints i's value as 10.

Is This Answer Correct ?    6 Yes 8 No

Post New Answer

More C Code Interview Questions

programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h

1 Answers  


int a=1; printf("%d %d %d",a++,a++,a); need o/p in 'c' and what explanation too

1 Answers  


Is it possible to type a name in command line without ant quotes?

1 Answers   Excel, Infosys,


4. Main() { Int i=3,j=2,c=0,m; m=i&&j||c&I; printf(“%d%d%d%d”,I,j,c,m); }

2 Answers   Broadridge,


x=2 y=3 z=2 x++ + y++; printf("%d%d" x,y);

2 Answers  






find simple interest & compund interest

2 Answers  


main() { if ((1||0) && (0||1)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above

5 Answers   HCL,


main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }

4 Answers   CSC,


can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

0 Answers   TCS,


main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }

6 Answers  


Is the following code legal? struct a { int x; struct a *b; }

2 Answers  


How to access command-line arguments?

4 Answers  


Categories