void main()
{
void *v;
int integer=2;
int *i=&integer;
v=i;
printf("%d",(int*)*v);
}
this simple program will result in a compiler error saying:
Compiler Error. We cannot apply indirection on type void*
what exact does this error mean?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The error means exactly what it says. The error is triggered by the
*vsubexpression used in your code.Unary operator
*in C is often called indirection operator or dereference operator. In this case the compiler is telling you that it is illegal to apply unary*to a pointer of typevoid *.