r/C_Programming • u/Low_Minimum9920 • Jun 15 '26
Question Question regarding unsigned integers
What's the difference between an unsigned int and a normal integer?
11
Upvotes
r/C_Programming • u/Low_Minimum9920 • Jun 15 '26
What's the difference between an unsigned int and a normal integer?
View all comments
Show parent comment
2
u/flatfinger Jun 15 '26
Name one platform where it doesn’t work as described.
GCC, with optimizations enabled but without the -fwrapv flag.
The generated machine code for test() will unconditionally store 32768 to
arr[x]without regard for whether x is less than 0x8002.