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

what is the output of the below program & why ? #include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); }

6 Answers   CSC, IIIT,


main() { int a[10]; printf("%d",*a+1-*a+3); }

1 Answers  


main() { int i; clrscr(); for(i=0;i<5;i++) { printf("%d\n", 1L << i); } } a. 5, 4, 3, 2, 1 b. 0, 1, 2, 3, 4 c. 0, 1, 2, 4, 8 d. 1, 2, 4, 8, 16

4 Answers   HCL,


main() { int i=5,j=6,z; printf("%d",i+++j); }

2 Answers  


main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; printf("\n%d %d %d",a,*f1,*f2); }

6 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  


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  


There is a lucky draw held every day. if there is a winning number eg 1876,then all possible numbers like 1867,1687,1768 etc are the numbers that match irrespective of the position of the digit. Thus all these numbers qualify fr the lucky draw prize Assume there is no zero digit in any numbers. write a program to show all the possible winning numbers if a "winning number"is passed as an arguments to the function.

1 Answers   Nagarro,


main() { int x=5; clrscr(); for(;x<= 0;x--) { printf("x=%d ", x--); } } a. 5, 3, 1 b. 5, 2, 1, c. 5, 3, 1, -1, 3 d. –3, -1, 1, 3, 5

2 Answers   HCL,


Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.

9 Answers   Microsoft,


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() { show(); } void show() { printf("I'm the greatest"); }

2 Answers  


Categories