# Thread: uint16_t and uint32_t question!

1. ## uint16_t and uint32_t question!

Hi,
I am getting confused between uint16 and uint32.
uint16 has to 2 bytes[16 bits] and uint32 has 4 bytes[32 bits].

In my problem, uint16t value= 1112 , when i convert 1112 into binary i get 10001011000 [only 12 bits are present].

So how does the structure of 16 bits of 1112 look?

Second question
uint16t value= 1112

How does (uint32_t)value look? [32 bits representation of 1112]

Any pointers would be helpful

Niran

2. > So how does the structure of 16 bits of 1112 look?
It has 4 leading zero bits, then 10001011000

> How does (uint32_t)value look? [32 bits representation of 1112]
It has 20 leading zero bits, then 10001011000

3. Originally Posted by NiranjanRavi199
uint16 has to 2 bytes[16 bits] and uint32 has 4 bytes[32 bits].
You should be aware that while it is conventional to say that a byte is 8 bits, in C the number of bits in a byte is denoted by CHAR_BIT, and while it must be at least 8, it could be larger.

Originally Posted by NiranjanRavi199
So how does the structure of 16 bits of 1112 look?
You're dealing with unsigned integers so that's trivial: fill in the remaining leading bits with 0s.

4. Any pointers would be helpful
Code:
`int *foo;`
I couldn't help myself...

5. Originally Posted by click_here
Code:
`int *foo;`
i couldn't help myself...
bwahahahahaha!

6. Thank you for your help

Popular pages Recent additions