Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 6 months ago.
What size is char ?
What size is char in mbed ? Is it 8bit long ?
A site search does not show anything and I cannot find any reference to char anywhere
Thanks Kim
4 Answers
9 years, 6 months ago.
That information isn't on the mbed site because it is language specific, in c (c++) the char type is always 1 byte, and on the vast majority of devices 1 byte is 8 bits, (you will probably never encounter a device where a byte is not 8 bits)
for future reference: http://www.cplusplus.com/doc/tutorial/variables/
9 years, 6 months ago.
It is on the mbed site, only mbed search isn't exactly optimal :P
https://developer.mbed.org/handbook/C-Data-Types
9 years, 6 months ago.
One additional note - while the online compiler treats char as an unsigned number some c/c++ compilers default to treating char as a signed 8 bit number. If you are counting on the value being signed or unsigned for any calculations then it is best to be explicit in the declaration.