当前位置: C语言 -- 标准库 -- <iso646.h> -- not

not宏


概要:

#define not !


描述:

该宏是逻辑运算符!(逻辑非)的替代拼写方案。

逻辑非运算符的运算规则:

! =

! =


范例:
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
/*宏not范例*/

#include <iso646.h>
#include <stdio.h>

int main(void)
{
    const int arr[6] = {7,4,8,0,3,9};

    //输出0。
    for(int i=0; i<6; ++i)
    {
        if(not arr[i])
            printf("arr[%d] = %d\n",i,arr[i]);
    }

    return 0;
}


输出:

arr[3] = 0


相关内容:
not_eq 表示!=的宏。