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 the purpose of scanf() and printf() functions?

0 Answers  


Write the test cases for checking a variable having value in range -10.0 to +10.0?

0 Answers   Bosch,


how to find the sizof of any datatype using bit manipulations

3 Answers  


how to find the given number is prime or not?

6 Answers   IMS, ING,


What is the size of structure pointer in c?

0 Answers  






Write a C program to count the number of email on text

0 Answers  


Can U write a C-program to print the size of a data type without using the sizeof() operator? Explain how it works inside ?

3 Answers   HCL, TCS,


a c code by using memory allocation for add ,multiply of sprase matrixes

0 Answers  


Can you write a programmer for FACTORIAL using recursion?

0 Answers   ADP,


How do I round numbers?

0 Answers  


write a c/c++ programthat connects to a MYSQL server and checks if the INNoDB plug in is installed on it.If so your program should print the total number of disk writes by MYSQL.

0 Answers   BirlaSoft,


How do you define a function?

0 Answers  


Categories