We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
espression must have a constant value
i have a static struct variable having struct members and have to access this members on change of a count. so instead of using a switch case statement to load respective struct member (address) into a pointer, i thought of defining a local array of pointers to point struct members. but i get above error. I tried to specifically define the struct at address 0xA0000000 of my parallel SDRAM using __attribute__ ((at(0xA0000000)))
how can this be achieved using an array of pointers??
PS: LPC1788 - but dont think the problem is architecture dependent.
If the structs have identical data type, then it would be trivial to have an array of them.
If they haven't identical data type, then I really think you should consider a switch statement - how else will the code know what to do with a generic pointer that sometimes points to a struct of one type and at other times points to a struct of a different type?
how else will the code know what to do with a generic pointer that sometimes points to a struct of one type and at other times points to a struct of a different type? All the structures actually have character arrays where ascii values are stored. i have created structure & structure of structures (which contain the arrays) to organise the data which i can then access according to structures (groups).
And i want to create an array of pointers (i.e. address of memory locations). hence (according to me) compiler should only see it as an array of pointers to 1byte memory locations.
an array will make it easy to load the address into the pointer and start accessing the data from there.