Please explain how this code is executing.why we has used \":\" in structures.what is the use of colon in structures.what should be the output of sizeof operator.
It's a part of syntax of bit fields.
Here it means that a
occupies 3 bits, b
13 bits and c
only 1 bit.
Of course the structure will not occupy only 17 bits in memory, as it must be aligned to bytes as the smallest addressable memory unit, so sizeof(bit1)
will be at least 3 bytes (probably it will be aligned to some value related to a machine word, e.g. 4 bytes).
You can read more about the alignment here: Structure padding and packing.
I assumed that 1 byte is 8 bits size but there are some old or exotic architectures where bytes have another size.