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

Hi can anyone tell what is a start up code?

0 Answers   CTS,


What is const keyword in c?

0 Answers  


typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none

0 Answers  


What is scope rule of function in c?

0 Answers  


#include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) malloc(25); strcpy(p1,"Ramco"); strcpy(p2,"Systems"); strcat(p1,p2); printf("%s",p1); } Tell me the output?

6 Answers   Ramco,






What are pointers? What are different types of pointers?

0 Answers   Fidelity,


We can draw a box in cprogram by using only one printf();& without using graphic.h header file?

4 Answers   NIIT,


What are the advantages and disadvantages of c language?

0 Answers  


What is the relation between # and include<stdio.h>

5 Answers   HCL,


enum day = { jan = 1 ,feb=4, april, may} what is the value of may? a)4 b)5 c)6 d)11 e)none of the above

8 Answers   HCL, Wipro,


what different between c and c++

1 Answers  


what is the advantage of function pointer

16 Answers   CMC, CS, Freshdesk, L&T, LG Soft, Matrix, TCS,


Categories