Example
10: What are bit fields in structures? Give examples.
Solution 10: Bit fields allow the packing of data in a structure.
This is especially useful when
memory or data storage is at a premium. An integer takes 2 bytes in memory but sometimes it happens
that integer values to be stored need less than 2 bytes, wasting memory. By using these bit fields we
can save a lot of memory.
Do'stlaringiz bilan baham: