home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sams Teach Yourself C in 21 Days (6th Edition)
/
STYC216E.ISO
/
mac
/
Examples
/
Day04
/
List0405.c
< prev
next >
Wrap
C/C++ Source or Header
|
2002-04-13
|
438b
|
20 lines
/* Demonstrates the evaluation of relational expressions */
#include <stdio.h>
int a;
int main( void )
{
a = (5 == 5); /* Evaluates to 1 */
printf("\na = (5 == 5)\na = %d", a);
a = (5 != 5); /* Evaluates to 0 */
printf("\na = (5 != 5)\na = %d", a);
a = (12 == 12) + (5 != 1); /* Evaluates to 1 + 1 */
printf("\na = (12 == 12) + (5 != 1)\na = %d\n", a);
return 0;
}