About size int in C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

About size int in C

As we all know integer of 4 bytes i.e. 2^4=16 bits.... but it's allocate 32 bits in memory as 1 byte for sign representation..... but we can re present sign by 1 bit also...... so, why to use whole 8 bits?

3rd Feb 2020, 3:22 AM
DeWill
DeWill - avatar
3 Answers
+ 3
Bits calculation goes like this; sizeof(<type_name>) * <bits_per_byte> So when size of `int` type was 4; 4 * 8 => 32 bit integer And the sign marker is just 1 bit, not 1 byte (8 bits)
3rd Feb 2020, 4:08 AM
Ipang
+ 1
Ipang thanks buddy..... 👍🏻
5th Feb 2020, 2:19 AM
DeWill
DeWill - avatar
0
You're welcome buddy 👌
5th Feb 2020, 3:22 AM
Ipang