Bit fields in the C programming language

How to access all structure elements in C. Means I want to take all the data of variables in the structure.

struct data { char a:1; char b:2; char c:3; char d:1; } arr; 

I can access individual members using. operator. But I need to get access to all members of this structure. Please tell us how to do this.

0
source share
1 answer

As proposed to make the union of all data and the structure of the bit field.

 union { char Whole; struct data { char a:1; char b:2; char c:3; char d:1; } arr; } MyData; 
+2
source

All Articles