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

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

11 Answers  


What are the files which are automatically opened when a C file is executed?

1 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,


could you please send the program code for multiplying sparse matrix in c????

0 Answers  


How to access command-line arguments?

4 Answers  






Question: We would like to design and implement a programming solution to the reader-writer problem using semaphores in C language under UNIX. We assume that we have three readers and two writers processes that would run concurrently. A writer is to update (write) into one memory location (let’s say a variable of type integer named temp initialized to 0). In the other hand, a reader is to read the content of temp and display its content on the screen in a formatted output. One writer can access the shared data exclusively without the presence of other writer or any reader, whereas, a reader may access the shared memory for reading with the presence of other readers (but not writers).

1 Answers  


main(int argc, char **argv) { printf("enter the character"); getchar(); sum(argv[1],argv[2]); } sum(num1,num2) int num1,num2; { return num1+num2; }

1 Answers  


main() { char *p; p="Hello"; printf("%c\n",*&*p); }

1 Answers  


what is the code of the output of print the 10 fibonacci number series

2 Answers  


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

1 Answers  


int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }

2 Answers   CSC,


main() { char c=' ',x,convert(z); getc(c); if((c>='a') && (c<='z')) x=convert(c); printf("%c",x); } convert(z) { return z-32; }

1 Answers  


Categories