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

  1. /*                       express.c
  2.  *
  3.  *   Synopsis  - Assigns and outputs values of the variables 
  4.  *               x and y.
  5.  *
  6.  *   Objective - Demonstrates expression statements and the 
  7.  *               values of assignment statements.
  8.  */
  9.  
  10. /* Include Files */
  11. #include <stdio.h>
  12.  
  13. int main( void )
  14. {
  15.      int x = 1, y, z;
  16.  
  17.      printf("Value of x, %d\n", x);               /* Note 1 */
  18.      printf("Value of 2*x + 5, %d\n", 2*x + 5);   /* Note 1 */
  19.                                                   /* Note 2 */
  20.      printf("Value of assignment to x, %d\n", x = 5);
  21.  
  22.                                                   /* Note 3 */
  23.      printf("Value of assignment to y, %d\n", y = 2*x++ + 1);
  24.      printf("x is %d and y is %d\n", x, y);
  25.  
  26.      z = y = 4*x + 5;                             /* Note 4 */
  27.      printf("y is %d and z is %d.\n", y, z);
  28.      return 0;
  29. }
  30.