SOURCE FILE: EX0305.CPP


// Example 3.5. An attempt at communication between functions   
   
#include <iostream.h>
   
int main(void)   
{   
   void modify_i(void);   // prototype local to main 
   int i;                 // local to main 
   
   i = 1;                 // local variable is assigned 1 
   cout << "Before calling modify_i, i equals " << i << endl;   
   modify_i();   
   cout << "After  calling modify_i, i equals " << i << endl;   
   
   return 0;
}   
   
//   
// Function with local variable i   
// Pre:  none   
// Post: Local variable i is assigned 3.   
//    
   
void modify_i(void)   
{   
   int i;      // local to modify_i 
   
   i = 3;      // local i is assigned 3 
}