uint is a keyword that is used to declare a variable which can store an integral type of value (unsigned integer) from the range of 0 to 4,294,967,295. uint keyword occupies 4 bytes (32 bits) space in the memory C specifies the exact minimum storage size for each integer form. For example, short requires at least two bytes, and long requires at least four bytes. The compiler determines the size and range of a data type As a result, we should not hardcode the size and range values in the program. ------------------------------------------------------------------------------------- find the range in c Number of bits (n) = 10 Possiable Values Per Bit = 2 (zero/one) All 10-bits will be used to represent magnitude (unsigned integer). Total Possiable Number = 2ⁿ = 2¹⁰ = 1024 Range: 0 to (2¹⁰ - 1) Range: 0 to 1023 ------------------------------------------------------------------------------------- In the code part we will see that the number8 variable has a result of 255. Why? Because 255 is the maximum value of an unsigned char or an uint8_t. So if we put a value of 256, our result would be 0. Indeed, after 255 we go back to 0. For example if we added +1 for each number below, we'd have: 0 (First value of a char or 1 byte) 1 2 3 ... 250 251 252 253 254 255 (Max value of a char or 1 byte) 0 (First value of a char or 1 byte) 1 2 3 ... until 255 (Max value of a char or 1 byte) ------------------------------------------------------------------------------------- normal integer int = int32_t Int Ranges Int8 — [-128 : 127] Int16 — [-32768 : 32767] Int32 — [-2147483648 : 2147483647] Int64 — [-9223372036854775808 : 9223372036854775807] Int128 — [-170141183460469231731687303715884105728 : 170141183460469231731687303715884105727] Int256 — [-57896044618658097711785492504343953926634992332820282019728792003956564819968 : 57896044618658097711785492504343953926634992332820282019728792003956564819967] Aliases: Int8 — TINYINT, BOOL, BOOLEAN, INT1. Int16 — SMALLINT, INT2. Int32 — INT, INT4, INTEGER. Int64 — BIGINT. UInt Ranges UInt8 — [0 : 255] UInt16 — [0 : 65535] UInt32 — [0 : 4294967295] UInt64 — [0 : 18446744073709551615] UInt128 — [0 : 340282366920938463463374607431768211455] UInt256 — [0 : 115792089237316195423570985008687907853269984665640564039457584007913129639935] ------------------------------------------------------------------------------------- uint8_t= unsigned char So uint8_t isn't guaranteed to exist, though it will for all platforms where 8 bits = 1 byte. Some embedded platforms may be different, but that's getting very rare. Some systems may define char types to be 16 bits, in which case there probably won't be an 8-bit type of any kind.
To embed this program on your website, copy the following code and paste it into your website's HTML: