运算符宏
头文件 <iso646.h>
中定义的运算符宏如下表。可以使用这些宏代替运算符。
运算符 | 宏 |
---|---|
&& | eq |
&= | and_eq |
& | bitand |
| | bitor |
~ | compl |
! | not |
!= | not_eq |
|| | or |
|= | or_eq |
^ | xor |
^= | xor_eq |
示例:
c
#include <stdio.h>
#include <iso646.h>
int main() {
int a = 5, b = 10;
if (a not_eq b) {
printf("a and b are not equal\n");
} else {
printf("a and b are equal\n");
}
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12