YOUR AD GOES HERE

char c = 255; c + 10; prints 9 #c

Published 25, Aug 2026

Prompt & Compile


Description:
char c = 255; c = c + 10; printf gives 9. Not 265, not 255. The reason is that the addition was never 255 + 10. Plain char is signed on x86, so it runs from -128 to 127 and 255 does not fit. The value stored is -1. The arithmetic was -1 + 10, which is 9. Whether plain char is signed is implementation defined, not a rule of the language. On many ARM toolchains it is unsigned and the identical code behaves differently. Say signed char or unsigned char whenever the sign matters. Reproduced with gcc 6.3.0 on Windows.

If this made it click, subscribe to @promptandcompile - programming, AI and CS fundamentals without the jargon.

More concepts on Instagram:
https://www.instagram.com/pixel2program/

#shorts #c #programming #computerscience #placement

Releted More Videos

  • Sorry!!! Nothing to show

You May Also Like

YOUR AD GOES HERE

YOUR AD GOES HERE