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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With