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 / phani

No its invalid.A variable declared as static cannot be
changed though it is a global variable.

Is This Answer Correct ?    20 Yes 3 No

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

Answer / anil

variable/function defined static make the scope limited to
only the file in which it is defined and cannot be accessed
outside the file. Hence it is invalid

Is This Answer Correct ?    6 Yes 0 No

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

Answer / sumit mondal

yes of course it is valid.

Is This Answer Correct ?    6 Yes 5 No

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

Answer / guest

yes

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Interview Questions

what is pointer?

13 Answers   HCL, TCS,


Write a program to remove the C comments(/* */) and C++ comments(//) from a file. The file should be declared in command line.

4 Answers   Persistent, Subex,


How do you construct an increment statement or decrement statement in C?

0 Answers  


Write a program to enter the name and age. If age>28 then find salary categories. if age<28 then find that you are gaduate or not.

1 Answers  


What's wrong with "char *p = malloc(10);" ?

4 Answers  






GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA

0 Answers  


wat are the two methods for swapping two numbers without using temp variable??

2 Answers  


Differentiate between Macro and ordinary definition.

0 Answers   Motorola,


Tell me when is a void pointer used?

0 Answers  


What is logical error?

0 Answers  


write a program to copy the string using switch case?

0 Answers   Mind Tree,


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

6 Answers   Honeywell, TCS,


Categories