Hello everyone,
I am having a problem with typecasting void pointers.I have read the pointer basics but still cant understand why the following test code doesnt work.
void *xyz;
struct abcd
{
int a;
};
struct abcd a,*ptra;
ptra=&a;
xyz=(struct abcd *)ptra; //doesnt work but no error shown.
.
.
printf("%d \n",xyz->a);
}
warning: dereferencing void * pointer (obviously,typecasting didnt work)
error : request for member a in something not a structure or union;
Am i missing some pointer concepts here?
Thanks,
Sritej