ctypedefuint8t

What is the advantage of uint8_t over unsigned char?


What is the advantage of using uint8_t over unsigned char in C?

I know that on almost every system uint8_t is just a typedef for unsigned char, so why use it?


Solution

  • It documents your intent - you will be storing small numbers, rather than a character.

    Also it looks nicer if you're using other typedefs such as uint16_t or int32_t.