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 / mistake1.c < prev    next >
C/C++ Source or Header  |  2005-06-16  |  594b  |  26 lines

  1. /*                         mistake1.c
  2.  *
  3.  *   Synopsis  - Accepts input of a value of type int and issues 
  4.  *               messages about its value.  
  5.  *
  6.  *   Objective - To further illustrate that an assignment is
  7.  *               an expression.
  8.  */
  9.  
  10. /* Include Files */
  11. #include <stdio.h>
  12.  
  13. int main( void )
  14. {
  15.      int intvar;
  16.  
  17.      printf( "Enter a decimal value : " );
  18.      scanf( "%d", &intvar );
  19.  
  20.      if ( intvar = 3 )                         /* Note 1 */
  21.      printf( "It's THREE!!\n" );
  22.  
  23.      printf( "The value of intvar is %d.\n", intvar );
  24.      return 0;
  25. }
  26.