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

Can true be a variable name in c?

0 Answers  


What is local and global variable in c?

0 Answers  


Why is c faster?

0 Answers  


In which header file is the null macro defined?

0 Answers  


Explain function?

0 Answers  






What is main return c?

0 Answers  


how can i get the output 54321 4321 321 21 1 in c programming........???? pls help......

10 Answers   Infosys,


sir i wanted to know how we wap in c to add numbers without using arithmetic operator in which digits are entered by user?

2 Answers  


How can I find out how much memory is available?

1 Answers   Persistent,


how to reverse string "Hello World" by using pointers only. Without any temp var

1 Answers  


The code is::::: if(condition) Printf("Hello"); Else Printf("World"); What will be the condition in if in such a way that both Hello and world are printed in a single attempt?????? Single Attempt in the sense... It must first print "Hello" and it Must go to else part and print "World"..... No loops, Recursion are allowed........................

14 Answers   HOV Services, IBM, Potty,


where do we use volatile keyword?

1 Answers  


Categories