Advertisement
dllbridge

Untitled

Oct 7th, 2024
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. //++++++++++++++
  2. //  main.cpp
  3. //++++++++++++++
  4.  
  5. #include   <stdio.h>
  6.  
  7. int foo();
  8.  
  9. extern int i;
  10.  
  11. ///////////////////////////////////////////////////////////
  12. int main()
  13. {
  14.    
  15.    
  16.    
  17.     for(; i < 9; i++)
  18.     {              
  19.        printf("foo returned %d \n", foo());    
  20.     }
  21.    
  22. return 0;
  23. }
  24.  
  25.  
  26.  
  27. //++++++++++++++
  28. //  f1.cpp
  29. //++++++++++++++
  30.  
  31. static int i = 0;
  32.  
  33.  
  34. ///////////////////////////////////////////////////////////
  35. int foo()
  36. {
  37.    
  38.     static int n = 1;
  39.    
  40.     n ++;
  41.    
  42. return n;    
  43. }
  44.  
  45.  
  46.  
  47.  
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement