Is the integer constant's default type signed or unsigned?
c
Solution
C has different rules for decimal, octal and hexadecimal constants.
For decimal, it is the first type the value can fit in: `int`, `long`, `long long`
For hexadecimal, it is the first type the value can fit in: `int`, `unsigned int`, `long`, `unsigned long`, `long long`, `unsigned long long`
For example on a system with `32-bit` `int` and `unsigned int`: `0x80000000` is `unsigned int`.
Note that for decimal constants, C90 had different rules (but rules didn't change for hexadecimal constants).
Problem
Is the integer constant's default type signed or unsigned? such as 0x80000000, how can I to decide to use it as a signed integer constant or unsigned integer constant without any suffix? If it is a signed integer constant, how to explain following case? ``` printf("0x80000000>>3 : %x\n", 0x80000000>>3); ``` output: ``` 0x80000000>>3 : 10000000 ``` The below case can indicate my platform uses arithmetic bitwise shift, not logic bitwise shift: ``` int n = 0x80000000; printf("n>>3: %x\n", n>>3); ``` output: ``` n>>3: f0000000 ```