uint8_t vs unsigned char

Lyndon White picture Lyndon White · Nov 12, 2009 · Viewed 303k times · Source

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?

Answer

Mark Ransom picture Mark Ransom · Nov 12, 2009

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.