If i declare something like this
struct S{
unsigned int bit:4;
}
How is it working?
- I allocate 2 bytes in memory(size of structure(got this size from here http://en.cppreference.com/w/cpp/language/bit_field) but use only 4 bits of it, and other memory in that structure is wasted.
- I allocate only 4 bits, nothing more.
I'm very confused about this and can't find any info about this anywhere.