How to access entire structure members in C.Means I want to take all the data of variables in structure.
struct data
{
char a:1;
char b:2;
char c:3;
char d:1;
} arr;
I can access individual members by using . operator.But i need to access all members in that structure.Colud you please tell me how to do.
As suggested make an union of the whole data and of the bitfield structure.
union
{
char Whole;
struct data
{
char a:1;
char b:2;
char c:3;
char d:1;
} arr;
} MyData;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.