Concept of bit fields
- by user1369975
Whenever I read a code like this:
struct node
{
int x : 2;
int p : 4;
}n;
with bit fields involved, I get really confused, as to how they are represented in memory, what is sizeof(n) etc., how does it differ with normal members of structures? I tried referring K&R and http://en.wikipedia.org/wiki/Bit_field but they little to remove my confusion. What concepts of bit fields am I failing to grasp?