Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void f(int);
- int main()
- {
- f(2);//kiirja a kettot mert 0 + 2 = 2
- f(3);//kiirja az 5ost mert 2 + 3 = 5, a 2 megmaradt az x-ben az elozo meghivastol
- return 0;
- }
- void f(int n)
- {
- static int x; //amikor indul a program 0 ertekkel deklaralodik
- cout<<x+n;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement