Download Valeo Exam Cafc PDF

TitleValeo Exam Cafc
TagsEmbedded System C (Programming Language) Software Testing Unit Testing
File Size251.6 KB
Total Pages17
Document Text Contents
Page 1

Page 2

Page 8

Is one of this parameters is static, extern can’t be used

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


It is also not uncommon to find function prototypes declared as extern.

A good C manual will certainly answer this more completely.


Volatile variables, variables that can be changed by an external process


A variable that retains the same data throughout the execution of a program. In

contrast, a dynamic variable can have different values during the course of a



'int' type?? 'unsigned char' type?? (size)

Int =16 bit

Long int = 32 bit

Similer Documents