What does extern mean in a function declaration?

Answers were Sorted based on User's Feedback



What does extern mean in a function declaration?..

Answer / swetcha

extern is significant only with data declarations. In
function declarations, it can be used as a stylistic hint
to indicate that the function's definition is probably in
another source file, but there is no formal difference
between

extern int f();

and
int f();

Is This Answer Correct ?    91 Yes 14 No

What does extern mean in a function declaration?..

Answer / poornima

extern is a keyword that is prefixed in function
declaration. It means tht function definition is in source
file.
for eg.
source file contains int sum(int x,int y) definition part.
To make use of this function in file by simply declare as
extern int sum(int ,int); is a good practice.
But to compiler happy extern sum(); is enough.

Is This Answer Correct ?    34 Yes 16 No

What does extern mean in a function declaration?..

Answer / zxg

(from MSDN)
Functions declared as extern are visible throughout all source files in the program (unless you later redeclare such a function as static). Any function can call an extern function.

Function declarations that omit the storage-class specifier are extern by default.

Is This Answer Correct ?    4 Yes 3 No

What does extern mean in a function declaration?..

Answer / aravind

Extern is nothing but a memory storage type.If we declare extern before the function than the variable can be accessed by that function not only locally but externally too.
extern int a=4
Int fun (int x)
{
x=a;
print gives a=4

Is This Answer Correct ?    8 Yes 19 No

Post New Answer

More C Interview Questions

Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10

1 Answers   CMS,


Write a c code segment using a for loop that calculates and prints the sum of the even integers from 2 to 30, inclusive?

4 Answers  


what does ‘#include’ mean?

1 Answers   TCS,


what is the difference between #include<> and #include”…”?

5 Answers  


What is the most efficient way to count the number of bits which are set in a value?

4 Answers  






to find out the reverse digit of a given number

6 Answers   Infosys, Microsoft, TCS, Wipro,


Why preprocessor should come before source code?

2 Answers  


Expand the following LKB BKL FFG

0 Answers  


What is the difference between class and object in c?

0 Answers  


write a program to find lcm and hcf of two numbers??

1 Answers  


wat is the output int main() { char s1[]="Hello"; char s2[]="Hello"; if(s1==s2) printf("Same"); else printf("Diff"); }

3 Answers  


what are # pragma staments?

0 Answers  


Categories