What does extern mean in a function declaration?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
Hi can anyone tell what is a start up code?
What is const keyword in c?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
What is scope rule of function in c?
#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?
What are pointers? What are different types of pointers?
We can draw a box in cprogram by using only one printf();& without using graphic.h header file?
What are the advantages and disadvantages of c language?
What is the relation between # and include<stdio.h>
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
what different between c and c++
what is the advantage of function pointer
16 Answers CMC, CS, Freshdesk, L&T, LG Soft, Matrix, TCS,