what if structwas like this? wouldi call it same wayCode:typedef struct Dip_gat { uint16_t inst union { int k 1; } data; int f; } Dip;
what if structwas like this? wouldi call it same wayCode:typedef struct Dip_gat { uint16_t inst union { int k 1; } data; int f; } Dip;
thank you
i want to be able to change value of t1Code:#include <stdio.h> typedef struct { int inst; void * t1; } Dip; int func(Dip *req) { int response; if (req->inst == 0) { response = 0; } else { response = 1; } return response; } int main(void) { int result; Dip req; req.inst = 1; result = func(&req); printf("inst=%d; result=%d\n", req.inst, result); //change value of t1 t1 x; &x =1; req.inst = 0; result = func(&req); printf("inst=%d; result=%d\n", req.inst, result); return 0; }
prog.c: In function 'main':
prog.c:29:5: error: unknown type name 't1'
t1 x;
^
prog.c:30:7: error: lvalue required as left operand of assignment
&x=1;
^
why is it giving me unknown type name
what is l value?