Can we use bit field of an array which is a part of the structure? Is this possible in C?
typedef struct convert
{
unsigned char data[7] : 5; //5x7
};
No you can not do that.
int
struct
. If your array is small enough then you may assign them individual names and make 7 5-bit bitfields, but that is probably not what you want.
Shifting them manually with a macro will be your best bet and as fast.
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.