home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / _DISK_ / ch8 / driver.c < prev    next >
C/C++ Source or Header  |  2005-06-16  |  819b  |  35 lines

  1. /*                      driver.c
  2.  *
  3.  *   Synopsis  - Displays the value of a variable, increments it,
  4.  *               and displays it again.
  5.  *
  6.  *   Objective - To demonstrate a very simple modular program 
  7.  *               with a variable declared externally.
  8.  */
  9.  
  10. /* Global Variables */
  11. int x = 5;                                              /* Note 1 */
  12.  
  13. /* Function Prototypes*/
  14. extern void output( void );                             /* Note 2 */
  15. /* PRECONDITION:  none.
  16.  *
  17.  * POSTCONDITION: displays the value of the variable x. 
  18.  *
  19.  */
  20.  
  21. extern void incr( void );
  22. /* PRECONDITION:  none.
  23.  *
  24.  * POSTCONDITION: increments the variable x. 
  25.  *
  26.  */
  27.  
  28. int main( void )
  29. {
  30.      output();                                         /* Note 3 */
  31.      incr();
  32.      output();
  33.      return 0;
  34. }
  35.