This code gives me an error:- error C2223: left of '->y' must point to struct/unionCode:typedef struct abc { int y; char *b; }abc, *abcptr; abc x={2,"sdgare"}; void *a; void function(void *data) { a=data; } int main() { function(&x); printf("%d",(abcptr)(a)->y); return 0; }
Could someone please tell me why and how to make it work?
Thanks in advance!