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.
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
Thanks Andy,
I was in a bookshop last night and definately saw an example written in the way I used it. But I purchased another book Sam's which doesn't. I'm not doubting you, because it doesn't work, but I will go back and take another look at the book for the heck of it.
Thanks about the local, got it.