Variables
Variables which are declared into the frames from one function are called local variables. They can be used in expressions which are just in the function. The local variables aren’t available for the others outside functions.
#include <iostream> |
The local variable is designing when invoke the function, but it is destroying when it goes out from the function. That means that the function doesn’t retains its value between two invokes from the function. In the literature the local variable often is called and automatic and somewhere it can meets the modification on the variable auto, but for lots of compilers that implies and there isn’t necessity of especially investiture.
Which is the manner for the variable to retain its value between few calls from the functions? One solution is the global variable. The global variable retains its value while the program exists. The global variable is declared outside from the all functions. Global variable can be addressed to each function, it is available for all functions it the program.
#include <iostream> int count; int main() |
0 comments:
Post a Comment