This book is incorrect. According to C11 6.4.4.1, the type of the integer constants of the hexadecimal value is determined from this table:
Suffix ... Octal or Hexadecimal Constant None ... int unsigned int long int unsigned long int long long int unsigned long long int u or U ... unsigned int unsigned long int unsigned long long int
Your 0xAA constant 0xAA not have a suffix, so the top of the table above applies. Value: the compiler first checks to see if the value matches in int . If it does not fit, it checks to see if it matches unsigned int , etc.
In any known C implementation, the value 0xAA will certainly match inside an int . The correct answer to the question is: int .
However, if the constant were 0xAAu , the bottom of the cited table would be applied, and the result would be unsigned int .
source share