Using structure a character variable is declared. I want to access(read and write) all the bit of that character type variable. I have solved that in my way using Bit Field. The code is given below. But if i want to print them they should be called individually. I am unable to call them in a loop.
#include<stdio.h>
struct SevenSegmentValue
{
unsigned char bit0:1;
unsigned char bit1:1;
unsigned char bit2:1;
};
struct SevenSegmentValue abc[3]={{1,0,1},{0,1,1},{1,1,0}};
int main(void)
{
printf( "Memory size occupied by status1 : %d\n", sizeof(abc));
printf( "Memory size occupied by status1 : %d\n", abc[2].bit0);
printf( "Memory size occupied by status1 : %d\n", abc[2].bit1);
printf( "Memory size occupied by status1 : %d\n", abc[2].bit2);
}