Showing posts with label variables. Show all posts
Showing posts with label variables. Show all posts

Wednesday, 28 October 2015

Difference between uint8_t and unsigned char, uint16_t or uint32_t and unsigned int

Have you ever wondered why people uses different keywords to define the same variable in C or C++ program?

Sometimes you would have noticed that 8 bit variable has been defined as

unsigned char a;
uint8_t       b;

Also, many a times you would notice integer has been defined as

unsigned int c;
uint16_t     d;
uint32_t     e;

Initially when I was in the learning phase of C programming with microcontrollers, I used to get confused, what to use when.