unions ?

I want to make a function that accepts 3 calling parameters but one of which is either be a string or an integer. So in an attempt to realise it I started to play with the following.

But I get a warning on APItest.c(62): error: #137: expression must be a modifiable lvalue.

I just cannot get it to work. From what I can find in the Keil manual it should work. I would really appreciate some guidence.

Note I can only look at the results in the watch window if I declare the struct in main as static - is that only way?

#define STRING 'S'
#define INTEGER 'I'

struct one_line
  {
  char type;
  int sn_id;
  int frm_id;
     union {
            char sp[20];
            int si;
     }tag;
  };

int main(void)
{
static struct one_line api;

         api.frm_id= 0x04;
         api.type = INTEGER;
         api.tag.si = 0x0300;
         api.type = STRING;
         api.tag.sp = "Hello"; \ error on this item
etc

More questions in this forum