编译环境 x86_64-w64-mingw32 gcc version 8.1.0
操作系统 window 10 X64
code
#include <stdio.h>
#define uint8_t unsigned char
#define uint32_t unsigned int
int main()
{
uint8_t logic_1 = 0;
uint8_t logic_2 = 0;
uint8_t logic_3 = 0;
for(logic_1 = 0;logic_1 < 2 ; logic_1++)
{
for(logic_2 = 0;logic_2 < 2 ; logic_2++)
{
for(logic_3 = 0; logic_3<2 ; logic_3++)
{
if( logic_1 != logic_2 && logic_3)
{
printf("Is True : logic_1 = %d != logic_2 = %d && logic_3 = %d
",logic_1,logic_2,logic_3);
}
else
{
printf("Is Flase : logic_1 = %d != logic_2 = %d && logic_3 = %d
",logic_1,logic_2,logic_3);
}
}
}
}
return 0;
}
显示
PS C:UsersAdministratorTestLogic> gcc -o main main.c
PS C:UsersAdministratorTestLogic> ./main.exe
Is Flase : logic_1 = 0 != logic_2 = 0 && logic_3 = 0
Is Flase : logic_1 = 0 != logic_2 = 0 && logic_3 = 1
Is Flase : logic_1 = 0 != logic_2 = 1 && logic_3 = 0
Is True : logic_1 = 0 != logic_2 = 1 && logic_3 = 1
Is True : logic_1 = 1 != logic_2 = 0 && logic_3 = 0
Is Flase : logic_1 = 1 != logic_2 = 0 && logic_3 = 1
Is Flase : logic_1 = 1 != logic_2 = 1 && logic_3 = 0
Is Flase : logic_1 = 1 != logic_2 = 1 && logic_3 = 1
PS C:UsersAdministratorTestLogic>