<< 0 and 1 directly define the C language macro definition 1 What is the difference

[Example 1] Program

The sample code:

#include <stdio.h>

#define TEST1 1 << 0
#define TEST2 (1 << 0)
#define TEST3 1

int main()
{
   printf("%#x \n", TEST1 + 4);
   printf("%#x \n", TEST2 + 4);
   printf("%#x \n", TEST3 + 4);
   return 0;
}

/*
0x10 
0x5
0x5
*/

Above.

[2] summary

Operator (<< and +) of different priorities, the results may lead to differences.

Seek truth from facts, according to local conditions, specific conditions.

Good Good Study, Day Day Up.

Select the cycle order summary

Guess you like

Origin www.cnblogs.com/Braveliu/p/11289085.html