This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Bitfield Array

Hello to everyone,
I want to my ARM7 to access a (const)bitfield array, but as i'am absolute beginner not sure about C-syntax. My textbook don't includes Bitfield-Array.
Hope someone takes a look at this:

struct
{
unsigned char red[32]                   :1;
unsigned char orange[32]                :1;
unsigned char yellow[32]                :1;
unsigned char green[32]                 :1;
unsigned char blue[32]                  :1;
unsigned char violett[32]               :1;
} my_color;
const my_color.red[]    ={1,0,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,0,0,1,1,1,1,0,1,1};
const my_color.orange[] ={0,1,0,1,1,1,0,0,1,1,1,1,0,1,0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,0,1};
const my_color.yellow[] ={1,0,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,0,0,1,1,1,1,0,1,1};
const my_color.green[]  ={0,1,0,1,1,1,0,0,1,1,1,1,0,1,0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,0,1};
const my_color.blue[]   ={1,0,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,0,0,1,1,1,1,0,1,1};
const my_color.violett[]={0,1,0,1,1,1,0,0,1,1,1,1,0,1,0,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,0,1};
int main (void)
{
        int i;

        for(i=0;i<32;i++)
        {
                printf("%u ",my_color.red[i]);
                printf("%u ",my_color.orange[i]);
                printf("%u ",my_color.yellow[i]);
                printf("%u ",my_color.green[i]);
                printf("%u ",my_color.blue[i]);
                printf("%u ",my_color.violett[i]);
                printf("%u\n",i);
        }
        while(1){}


first as i tried some syntax-variations i just got normal errormessages or programms didn't what i expected to do. But suddenly after some time my programm makes CA stop with a WINDOWS errormessage
:ca.exe hat Fehler verursacht und wird geschlossen. Starten Sie das Programm neu. Ein Fehlerprotokoll wird erstellt. OK
How can i bring my little blinky-toy to the water?
:-)

0