next up previous contents
Next: 邏輯運算子 Up: 運算子 Previous: 算術運算子   Contents

關係運算子

  1. ==
    int A=10, B=20, C;
    C=(A==B);
    printf("C=%d\n",C);
    
  2. !=
    int A=10, B=20, C;
    C=(A!=B);
    printf("C=%d\n",C);
    
  3. >
    int A=10, B=20, C;
    C=(A>B);
    printf("C=%d\n",C);
    
  4. <
    int A=10, B=20, C;
    C=(A<B);
    printf("C=%d\n",C);
    
  5. >=
    int A=10, B=20, C;
    C=(A>=B);
    printf("C=%d\n",C);
    
  6. <=
    int A=10, B=20, C;
    C=(A<=B);
    printf("C=%d\n",C);
    



2015-01-16