i have the following code:
#define NULL ((void*)0)
void* Globalptr = NULL;
void func(ptrtype* input)
{
((ptrtype*)Globalptr) = input;
}
I get Error on line ((ptrtype*)Globalptr) = input;
says " expression must be a modifiable lvalue"
You must make the data to match the variable (lvalue), and not change the type of the variable to match the data:
Globalptr = (void*)input;
But since you can convert any data pointer to void*
in C, you can simply do:
Globalptr = input;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句