0
What is the static variable?
3 Réponses
+ 2
A static variable is a variable that is common to every call of the function, for example :
int f(){
static int count=0;
return ++count;
}
int main(){
std::cout<<f()<<std::endl;
std::cout<<f()<<std::endl;
return 0;
}
the result will be
1
2
0
thanks broo.
0
your welcome :)