Home » Archives for December 1st, 2009
Local and Global Functions
Local and Global Functions:
The functions that are declared inside the main function or inside any other function are called local functions. They can he called only in that function in which they are declared. The functions that are declared outside the main functions are called global functions. They can he called by any function. The function prototypes defined in the header...
Static Variables
Static Variables:
Static variables arc special variables that are declared inside a function by using the keyword “static”. Like local variable, these can only be accessed in the function in which they are declared hut they remain in existence for the lifetime of the program. Another difference between local variables and static local variables is that the initialization...
Global Variables
Global Variables:
The variables that are declared outside the main function or any other function are called global variables or external variables. These variables can he accessed in any function at any time during execution of the program. The global variables are used when variables are to he accessed by more than one function in a program. The global variables arc not normally...
Local Variables
Local Variables:
The variables that arc declared inside the main function or inside any user-defined function are called local variables. These variables are also called the automatic variables. The keyword “auto” can he used to declare these variables. For example,
auto int a, b, c;
The use of keyword “auto” is optional. The variables used inside the functions...