#include using namespace std; int foo(); int main() { cout << foo() << endl; cout << foo() << endl; cout << foo() << endl; return 0; } int foo() { //int i = 0; //Variable i will be initialized every time the function is called. static int i = 0; //Variable i will be initialized at the first time and the value of i stays for next function call. i++; return i; }