Your error is on line 9, where youve attempted to dereference a pointer to void (the expression *p). You can only dereference typed pointers. The solution you are probably looking for would be to replace line 9 with
printf("%u", *(int*)p);
A pointer stores a memory address (typically a 32-bit or 64-bit unsigned integer, depending on compiler options) that points to an object of the specified type. Dereferencing the pointer returns the object at this memory address, as that specified type. Declaring a void pointer declares a memory address, but without specifying the type of object contained at that memory location. As such, the compiler does not have enough information to know what data you are trying to access.
In most cases you should avoid using void pointers, since they remove any type safety. This can have negative consequences if you try to dereference a void pointer as the wrong type. Using a typed pointer prevents these mistakes, without adding any additional run-time costs.

2 Users have rated as useful.
Login to rate this answer.
Ashok Kumar Orupalli
Answered On : Sep 3rd, 2012
You have to typecast void pointer to int as *(int*)p;
Code
#include<stdio.h>
#include<conio.h>
int main()
{
int a=10;
void *p;
p=&a;
clrscr();
getch();
return 0;
}
Login to rate this answer.