Search code examples
cintegerlanguage-lawyer

Is sizeof(int) == sizeof(unsigned int) guaranteed by the standard?


Many programs assume sizeof(int)==sizeof(unsigned int) . IMO it is not and I cant find anything in the Standard which guarantees it. Am I right or wrong?


Solution

  • C11 6.2.5.6 (Types) says "For each of the signed integer types, there is a corresponding (but different) unsigned integer type (designated with the keyword unsigned) that uses the same amount of storage (including sign information) and has the same alignment requirements."