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

main is a predefined or user define function if user defined why? if predefined whay?

12 Answers   TCS,


#include<stdio.h> #include<conio.h> void main() {clrscr(); char another='y'; int num; for(;another=='y';) { printf("Enter a number"); scanf("%d",&num); printf("squre of %d is %d",num,num*num); printf("\nwant to enter another number y/n"); scanf("%c",&another); } getch(); } the above code runs only one time.on entering 'y' the screen disappeares.what can i do?

3 Answers  


Find the O/p of the following struct node { char *name; int num; }; int main() { struct node s1={"Harry",1331}; struct node s2=s1; if(s1==s2) printf("Same"); else printf("Diff"); }

1 Answers  


What is the code for 3 questions and answer check in VisualBasic.Net?

0 Answers   Infosys,


What is the use of a ‘’ character?

0 Answers  






What is #error and use of it?

0 Answers  


Can you assign a different address to an array tag?

0 Answers  


What is difference between structure and union in c programming?

0 Answers  


Why is not a pointer null after calling free?

0 Answers  


write a program that print itself even if the source file is deleted?

2 Answers  


What is difference between the following 2 lines…. int temp = (int)(0x00); int temp = (0x00int);

3 Answers   Bosch,


what is answer for perfect number????????????????

1 Answers  


Categories