Evaluating relational expressions. - C Operator

C examples for Operator:Relational Operator

Description

Evaluating relational expressions.

Demo Code

#include <stdio.h>

int a;/*from ww  w  . j a va  2 s  . com*/

int main( void )
{
    a = (5 == 5);           /* a is 1 */

    printf("\na = (5 == 5)\na = %d", a);

    a = (5 != 5);           /* a is 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;
}

Result


Related Tutorials