Expression must be modifiable lvalue - c++ Error [closed]
I got the error when I execute the following code.
int *p;
p = (int *)malloc(128*sizeof(int *));
for (int i = 0; i < 128; i++)
{
(*p + i) = 0;
}
Expression must be modifiable lvalue
Have you tried *(p+i) = 0 ? Anyway, try to use C++ stuff, like shared_ptr or unique_ptr, or weak_ptr instead of * and malloc; or for your case use std::vector. -1 because it's not a question linked to OpenCV