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
1
u/imaami Jun 16 '26
The standard doesn't define unsigned wraparound as overflow at all. Unsigned arithmetic is defined as modulo arithmetic, and overflow does not happen for unsigned integers at all.
I know this is splitting hairs, though. In common parlance "overflow" and the wraparound resulting from modulo arithmetic are often used interchangeably, and that's fine as long as everyone is on the same page.