in one file global variable int i; is declared as static. In
another file it is extern int i=100;
Is this valid ?

Answers were Sorted based on User's Feedback



in one file global variable int i; is declared as static. In another file it is extern int i=100; ..

Answer / vadivel t

No. it is not valid,

Bcos we can not initialise a variable with an extern key
word.ie.,

The statement extern int i = 100; is wrong.

Is This Answer Correct ?    14 Yes 5 No

in one file global variable int i; is declared as static. In another file it is extern int i=100; ..

Answer / dipti

No its in valid as a static variable cannot be declared as extern.
The whole and entire purpose of static is to declare that a variable is private to the source file that it is declared in.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

What is a volatile keyword in c?

0 Answers  


Can you write the function prototype, definition and mention the other requirements.

0 Answers   Adobe,


What is function what are the types of function?

0 Answers  


What does c mean?

0 Answers  


What is #define in c?

0 Answers  






What is a class c rental property?

0 Answers  


WHOT IS CHAR?

4 Answers   TCS,


main() { unsigned int k = 987 , i = 0; char trans[10]; do { trans[i++] =(char) (k%16 > 9 ? k%16 - 10 + 'a' : '\0' ); } while(k /= 16); printf("%s\n", trans); }

4 Answers   Vector,


What is the significance of c program algorithms?

0 Answers  


Write a program to find whether the given number is prime or not?

6 Answers  


What are the different categories of functions in c?

0 Answers  


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

2 Answers  


Categories