Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Static Variables
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- void counter()
- {
- static int x = 0;
- cout << "This function has been called " << ++x << " times!" << endl;
- }
- int main()
- {
- counter();
- counter();
- counter();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement