I'm trying to create an array which at each index i have a bit field i tried this code:
struct bitF {
unsigned int x1:1;
...
unsigned int xn:1;
}intBF;
typedef struct intBF *arr[];
int main(){
int i;
unsigned int *arr2[10]
for(i=0;i<sizeof(arr2)/sizeof(unsigned int);i++)
{ arr2[i] = malloc(sizeof(intBF));
arr2[i] = (unsigned int *)(&intBF);
arr[i].x5 = 3;}
return 0;}
but i get error from the compiler for the last code line. i want to be able to go to the array at index 'n' and to change the bits values (without using masks). the compiler error (although i don't think it's relevant) is:
error: expected identifier or '(' before '[' token