-The 1l type is long int, And the 1u type is unsigned Int. For comparison, there is an implicit type conversion. In C, when a variable is long int, if the value range of long int can cover unsigned int, the variable of unsigned int is converted to long int; if the value range of long int cannot overwrite the unsigned int, the two variables are converted to unsigned long at the same time.
Assume that Int Is a 16-bit value, while long Int Is a 32-bit value. In this case, the value range of long int can cover the unsigned int, so 1u is converted to lont Int, -1l <1u.
In the current machine, int and long are generally 32-bit. In this case, the value range of long int cannot overwrite the unsigned Int, both variables are converted into unsigned long. After conversion, the value of-1l is 0 xffffffff. Then, the comparison result is-1l> 1u.
Reprinted from: http://blog.csdn.net/heziling/article/details/329499
-The 1l type is long int, And the 1u type is unsigned Int. For comparison, there is an implicit type conversion. In C, when a variable is long int, if the value range of long int can cover unsigned int, the variable of unsigned int is converted to long int; if the value range of long int cannot overwrite the unsigned int, the two variables are converted to unsigned long at the same time.
Assume that Int Is a 16-bit value, while long Int Is a 32-bit value. In this case, the value range of long int can cover the unsigned int, so 1u is converted to lont Int, -1l <1u.
In the current machine, int and long are generally 32-bit. In this case, the value range of long int cannot overwrite the unsigned Int, both variables are converted into unsigned long. After conversion, the value of-1l is 0 xffffffff. Then, the comparison result is-1l> 1u.
Reprinted from: http://blog.csdn.net/heziling/article/details/329499