main()

{

extern int i;

i=20;

printf("%d",sizeof(i));

}

Answers were Sorted based on User's Feedback



main() { extern int i; i=20; printf("%d",sizeof(i))..

Answer / susie

Answer :

Linker error: undefined symbol '_i'.

Explanation:

extern declaration specifies that the variable i is defined
somewhere else. The compiler passes the external variable to
be resolved by the linker. So compiler doesn't find an
error. During linking the linker searches for the definition
of i. Since it is not found the linker flags an error.

Is This Answer Correct ?    22 Yes 4 No

main() { extern int i; i=20; printf("%d",sizeof(i))..

Answer / sahoo845

This program throws error in compilation. Because variable i is declared but not defined anywhere. Essentially, the variable isn’t allocated any memory. And the program is trying to change the value to 20 of a variable that doesn’t exist at all.

Is This Answer Correct ?    4 Yes 3 No

Post New Answer

More C Code Interview Questions

main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit >> (i - (i -1))); } } a. 512, 256, 0, 0, 0 b. 256, 256, 0, 0, 0 c. 512, 512, 512, 512, 512 d. 256, 256, 256, 256, 256

2 Answers   HCL,


Is the following code legal? void main() { typedef struct a aType; aType someVariable; struct a { int x; aType *b; }; }

1 Answers  


How we print the table of 3 using for loop in c programing?

7 Answers  


What is the output of the program given below main() { signed char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

1 Answers  


Write a program to receive an integer and find it's octal equivalent. How can i do with using while loop.

2 Answers  






Code for 1>"ascii to string" 2>"string to ascii"

1 Answers   Aricent, Global Logic,


main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }

2 Answers  


to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD

6 Answers   Synergy,


All the combinations of prime numbers whose sum gives 32

1 Answers   HHH,


#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }

1 Answers  


#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }

2 Answers  


main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit = (bit >> (i - (i -1)))); } } a. 512, 256, 128, 64, 32 b. 256, 128, 64, 32, 16 c. 128, 64, 32, 16, 8 d. 64, 32, 16, 8, 4

2 Answers   HCL,


Categories