Reputation: 11
I'm working on structs and unions.
typedef struct _test {
int te;
}test;
typedef struct _resp {
int type;
union {
test *testptr;
}u;
}resp_t;
resp_t *resp;
how to access te using resp?
Upvotes: 0
Views: 51
Reputation: 1251
Don't forget to allocate enough space for your resp_t
strcuture.
To access the element, just do resp->u.testprt->te
Upvotes: 0