Declaration of a numeric constant as 'unsigned char'

Mar 11, 2011 at 6:52am
In C/C++, 128U makes it unsigned int, 128UL makes it unsigned long, etc. What suffix will make it an unsigned char?
Last edited on Mar 11, 2011 at 6:54am
Mar 11, 2011 at 7:33am
There are no such suffix.
Mar 11, 2011 at 8:11am
The char literals are between quotes. You can assign them to char, signed char and unsigned char. The default type for that would be char, whether that is signed or unsigned depends on the compiler ( which may have some option to change the default behaviour ).
If you want to be sure that a literal is interpreted as unsigned char you'll have to explicitly cast it.
Topic archived. No new replies allowed.