What is extern function?
An extern function 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 referring 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.
Defining:
extern int f(int a,int b)
It is also not uncommon to find function prototypes declared as extern.
Tags: extern function static function scope C
Readers also visit these:
What is data, database (DB), DBMS and DBS?What is view (database)?
What is stored procedure?
What is data model?
What is trigger?
Related Questions:
What is static function?What is data storage?
What is full text search?
What is data model?
Technical Support
Latest News
- How to connect to SQ...
- How to install Datab...
- How to remove SQL Se...
- How to compare and s...
- How many database ob...
- How to compare and s...
Awards
Customer Service |
| If you have any question or suggestion,please contact us. |
| Get Help>> |
:
: 

