Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void ppr()
- {
- int a = 0;
- static int b = 0;
- a++;
- b++;
- printf("a = %d, b = %d\n", a, b);
- }
- int main()
- {
- for(int i = 0; i<10; ++i) ppr();
- return 0;
- }
- /*
- output:
- a = 1, b = 1
- a = 1, b = 2
- a = 1, b = 3
- a = 1, b = 4
- a = 1, b = 5
- a = 1, b = 6
- a = 1, b = 7
- a = 1, b = 8
- a = 1, b = 9
- a = 1, b = 10
- */
Advertisement
Add Comment
Please, Sign In to add comment