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

Pointer to array in a structure?

hello,

i have a simple little structure like this

unsigned char index;

struct tag {
unsigned char a[20];
unsigned char b[20];
unsigned char c
};

then i declare a pointer like this

struct tag TAG_PTR;

it seems that TAG_PTR->c; is valid and generates no errors

however TAG_PTR->a[index]; generated BAD OPPERAND TYPE error

and TAG_PTR->a[10];(or any other constant value)
and TAG_PTR->a; generate no errors.

obviously using the index variable is the problem, but im not sure how to work around it. Any help would be greatly appreciated.

Parents
  • Hi Zeusti,

    (Sorry for my very limited English Skill.)

    There is a Read-Only thread discussing:

    http://www.keil.com/forum/16566/


    Author
    Cpt. Vince

    It seems to me that many of the 'regular' contributors are very savvy in the art of embedded design. I was wondering just what projects they are doing, or have done in the past that are worthy of mentioning?

    I think our readers might be interested in such works, and give the casual reader something to ponder: especially since they are taking advice from these 'regular' contributors.

    And it is a pity to me that, you didn't join that discussing.

    And I am also very interested in that, where do you come from? What language is your first language? (I come from Taiwan, I am a Taiwanese/Cantonese/Chinese.)

    Besides, I think that,
    do not change or you will no more be the Tapeer we all know.
    the above statement shows your wisdom.
    but remember to always read the manuals. we do not want more deafs.
    the above statement shows something negative and naughty.

    As a Chinese, I believe that:
    The sea can hold the water from thousands of rivers, it's big because of its capacity.
    A person is great when he can be tolerant and forgiving to many other people.

Reply
  • Hi Zeusti,

    (Sorry for my very limited English Skill.)

    There is a Read-Only thread discussing:

    http://www.keil.com/forum/16566/


    Author
    Cpt. Vince

    It seems to me that many of the 'regular' contributors are very savvy in the art of embedded design. I was wondering just what projects they are doing, or have done in the past that are worthy of mentioning?

    I think our readers might be interested in such works, and give the casual reader something to ponder: especially since they are taking advice from these 'regular' contributors.

    And it is a pity to me that, you didn't join that discussing.

    And I am also very interested in that, where do you come from? What language is your first language? (I come from Taiwan, I am a Taiwanese/Cantonese/Chinese.)

    Besides, I think that,
    do not change or you will no more be the Tapeer we all know.
    the above statement shows your wisdom.
    but remember to always read the manuals. we do not want more deafs.
    the above statement shows something negative and naughty.

    As a Chinese, I believe that:
    The sea can hold the water from thousands of rivers, it's big because of its capacity.
    A person is great when he can be tolerant and forgiving to many other people.

Children