Slide # 1

Slide # 1

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts Read More

Slide # 2

Slide # 2

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts Read More

Slide # 3

Slide # 3

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts Read More

Slide # 4

Slide # 4

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts Read More

Slide # 5

Slide # 5

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts Read More

Friday, November 12, 2010

C++ - Static

Static

The variables from the type static are constant in the frames in their function. They distinguish from the global because they aren’t familiar outside the function. The variable from the type static retains its value between invokes to the function. The variable’s value doesn’t dissipate when it goes out from the function. The local static variables initial just one time and it is in the start of the program.





#include <iostream>


using namespace std;


void f(){

        static int c=0;

        c++;

        cout<<c<<endl;


}

int main(){

        for(int i=0; i<10; i++)

                        f();

        return 0;


}

0 comments:

Post a Comment