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

Declare variable in the same location as that of a struct member

Hi All,
Am trying to re-write a code in PLM51 to embedded C.
There is a statement in PLM51 as below.

DECLARE TASK(17) STRUCTURE(PNTR BYTE,STATUS BYTE,DELAY WORD);
DECLARE DELAY_HEAD BYTE AT (.TASK(0).PNTR); //ERROR LINE//

What i have understood from this is-- DELAY_HEAD is a byte variable which resides at the same location as that of TASK(0).PNTR.(From the PLM51 manual)

I have rewritten the same into C as below.

struct tsk
{ unsigned char PNTR ; unsigned char STATUS; unsigned int DELAY;
}TASK[17];
unsigned char DELAY_HEAD _at_ &TASK[0].PNTR ;

But its giving error 221:non-constant case/dim expression.
Plss help..!!