answersLogoWhite

0

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.

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

What are c storage classes?

storage classes determines the part of memory where storage is allocated for an object. a scope specifies the part of the program which a variable name is visible, that is accessibility of the variable by its name. in c language there are four storage classes automatic, external, register, static.


What is a variable in C language?

variable which is used to specify the values and also we can that values through the variable name


What is puts in c language?

printf("%s",variable);


How you declare a variable in c language?

you have to give a statement in the following syntax datatype variable;


What is the variable in c language program?

A variable is the name for a place in the computer's memory where you store some data.


What is a constant variables in c language?

It are a variable you add modifer 'const' to. It means these variable mustn't be modified.


What is count in c language?

count is a function that counts the variable name.


Is “C language” case sensitive programminIs “C language” case sensitive programming language If yes why and if no whyg language If yes why and if no why?

C is case sensitive, which means that, for example, $var and $VAR are not the same variable.


In c language which variable is not valid?

eg: 7x 9# répa 'quote'


What is the definition of the term C static?

The term C static is a variable within computer programming in particular C Language. When set static the variable inside a function keeps its value between invocations.


Int a is literal in C language or not?

int a; -- variable definition"int a" -- string literal


Why c in and c out used in c?

In the programming language C++, cin is used to input the variable and cout is used to print a certain message or result.

Trending Questions
Quality and reliability are related concepts but are fundamentally different in a number of ways Discuss them? Can use stone dust as a filler material for bituminous concrete? How do you calculate how to split a 7.5Kw load over 3 phases? Why do people need to develop alternative sources of renewable energy and become less dependent on fossil fuels? What is the organizational structure of management in a power plant? How is a Residual Current Device or RCD different to a Ground Fault Circuit Interrupter or GFCI? What is the minimum value of power factor of a circuit can have under what circumstances can this occur? How data is represented in dbms? Why converting a base class pointer to a derived class pointer is consider dangerous by the compiler? What is the minimum value of Ir test in 11kv cables? If you are considering Ch 7 but do not want to include a newly purchased vehicle are you able to still file? In which layer will liquid petroleum be found in the oil trap shown in figure 4-1? What is better civil or electronics for engineering? What are the codes called that surround the HTML text? Accidentally drop cardboard down the toilet how do you get it out? Purpose of minimum flow line for centrifugal pump? How is hooke's law releted to torque wrench action? What are the procedure of construction of a well foundation? Is there a way to calculate the physical length of the groove on a compact disc based on the time length of the track? Which error is the violation of grammar rules of a programming language?