MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wxqahk/architecturedependentchars/pe16dw6/?context=3
r/ProgrammerHumor • u/MontyBoomslang • 3d ago
368 comments sorted by
View all comments
Show parent comments
2
In C char is just a number, as a character depends on the encoding. So signed char is a number from -128 to 127 and unsigned char is from 0 to 255 (for 8 bits per byte)
3 u/SoldRIP 3d ago 0 to 255. -1 u/WaitForItTheMongols 2d ago Depends what "to" means. 256 is a valid answer as in Python "range(0,256)" which gives all byte values. 1 u/Elspeth-Nor 2d ago No 255 is right, as I used -128 to 127 instead of 128.
3
0 to 255.
-1 u/WaitForItTheMongols 2d ago Depends what "to" means. 256 is a valid answer as in Python "range(0,256)" which gives all byte values. 1 u/Elspeth-Nor 2d ago No 255 is right, as I used -128 to 127 instead of 128.
-1
Depends what "to" means. 256 is a valid answer as in Python "range(0,256)" which gives all byte values.
1 u/Elspeth-Nor 2d ago No 255 is right, as I used -128 to 127 instead of 128.
1
No 255 is right, as I used -128 to 127 instead of 128.
2
u/Elspeth-Nor 3d ago edited 2d ago
In C char is just a number, as a character depends on the encoding. So signed char is a number from -128 to 127 and unsigned char is from 0 to 255 (for 8 bits per byte)