home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / tyc / list4_5.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-16  |  458 b   |  19 lines

  1.    /* Demonstrates the evaluation of relational expressions */
  2.  
  3.    #include <stdio.h>
  4.  
  5.    int a;
  6.    
  7.    main()
  8.    {
  9.       a = (5 == 5);           /* Evaluates to 1 */
  10.       printf("\na = (5 == 5)\na = %d", a);
  11.  
  12.       a = (5 != 5);           /* Evaluates to 0 */
  13.       printf("\na = (5 != 5)\na = %d", a);
  14.  
  15.       a = (12 == 12) + (5 != 1); /* Evaluates to 1 + 1 */
  16.       printf("\na = (12 == 12) + (5 != 1)\na = %d", a);
  17.       return 0;
  18.   }
  19.