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

How will u find whether a linked list has a loop or not?

8 Answers   Microsoft,


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

0 Answers  


int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.

2 Answers   Bosch, eInfochips, HCL, IHCL,


What is your nationality?

1 Answers   GoDB Tech,


#ifdef something int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }

1 Answers  






write a program in c language to get the value of arroy keys pressed and display the message which arrow key is pressed?

1 Answers  


Write a C function to search a number in the given list of numbers. donot use printf and scanf

5 Answers   Honeywell, TCS,


Who could write how to find a prime number in dynamic array?

1 Answers  


What are segment and offset addresses?

2 Answers   Infosys,


source code for delete data in array for c

1 Answers   TCS,


What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }

1 Answers  


Link list in reverse order.

8 Answers   NetApp,


Categories