Top Answer
User Avatar
Wiki User
Answered 2010-11-20 02:43:41

In C and C++, extern is a declaration of a variable or function, said declaration including the fact that the definition of that variable or function will occur in a different compilation unit, linking provided by the link editor or binder.

User Avatar

Your Answer

Related Questions

"Extern" variables, constants and functions appear in multi-module programming. The extern specification used with the C programming language is used in module A to describe variables, constants, or functions which module A will use, but module B defines.

Extern is not storage class.

"extern" is short of "external" which means outside.

There are four storage classes in ca) autob) registerc) staticd) extern

Storage classes are auto, register, static, extern and typedef (formally only).

The usual method: with its name: extern int errno; errno= 17;

extern specifies that the variable is in another file.say you have a variable(int k = 10) in mycpp1.cpp and you want to use it in mycpp2.cpp use the extern to redeclare the variable and use it.Example:Code://mycpp1.cppint k = 10;Code://mycpp2.cppextern int k;void function(void){cout }this will print10

Using a text editor. Example: /* myheader.h */ #ifndef MYHEADER_H #define MYHEADER_H extern int myvariable; extern int myfunction (int x, int y, int z); #endif

It are static, auto and extern.

I do use am a programmer, because C-language.

They is static, auto, extern and typedef. (Well, typedef aint't an actual storage class, it means type-definition.)

You declare it extern in the file you want to access it from. In the file that it is declared, declaring it at file scope automatically makes it visible to all files in the linkage scope. file1.c extern int a; ... ... use a file2.c int a ...

The extern keyword declares a variable or function and specifies that it has external linkage (its name is visible from files other than the one in which it's defined). When modifying a variable, extern specifies that the variable has static duration (it is allocated when the program begins and deallocated when the program ends). The variable or function may be defined in another source file, or later in the same file. Declarations of variables and functions at file scope are external by default. In C++, when used with a string, extern specifies that the linkage conventions of another language are being used for the declarator(s). C functions and data can be accessed only if they are previously declared as having C linkage. However, they must be defined in a separately compiled translation unit. Microsoft C++ supports the strings "C" and "C++" in the string-literal field. All of the standard include files use the extern "C" syntax to allow the run-time library functions to be used in C++ programs. If you find this info useful Please vote!!!

No such thing, pick one ot the three: static int x; extern int x; int x;

AUTO EXTERN STATIC are the storage classes in c++

The "extern" declaration in C is to indicate the existence of, and the type of, a global variable or function. A global variable, or a global function, is one that is available to all C modules (a single C module is typically a single .c file). An extern is something that is defined externally to the current module. In many cases, you can leave off the extern qualifier and not notice any difference because the linker can collapse multiple definitions to one. But the intent is then unclear in the code, and the code is error prone in case of typos. It is much clearer to define the global in one place, and then declare extern references to it in all the other places. When refering to globals provided by a library, especially a shared library, this is even more important in order to ensure you are talking about the correct, common instance of the variable. Declaring a variable as extern will result in your program not reserving any memory for the variable in the scope that it was declared. For instance (as example) if a program's source code declared the variable var as a global volatile int in foo.c, to properly use it in bar.c you would declare it as extern volatile int var. It is also not uncommon to find function prototypes declared as extern. A good C manual will certainly answer this more completely.

There is no part called 'loader' in C language.

extern variables are defined in different than the file where the main() is. extern variables can be accessed from other files. Static global variables are visible only within the file.


Reserve words, also known as keywords are words whose meaning are already defined by a compiler. C language has a total of 32 reserve words. Short, union, else, for, goto, unsigned, enum, extern, char, continue, switch, struct, typedef are some examples.

TO use a c language first step is to know about the c language and the steps to use the c progrmming language with the help of any elders or with the teachers. TO use the arrays you have to get th eknowledge of "c" language

You can use every standard C modifier in TurboC: long, short, signed, unsigned; and every storage class as well: static, extern, auto, register, typedef.

static, extern, auto, register (and typedef, but only formally)

You can put it before a variable-declaration; it means: this variable is defined somewhere else. You can use it before a function-declaration too, but it doesn't change anything.

Copyright ยฉ 2021 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.