c++ - how can I fix this error when allocating memory? -
the code below has error please me how can fix it. i'm beginner in c++.
int main(int argc, char **argv) { image=malloc(3*1450*900*sizeof(char)); /* allocate memory required save file */ thing else....} the error is: value of type "void*" cannot assigned entity of type "char*"
it's clear see in error report! should cast every thing @ other side of "=" operator (char*)!
image=(char*)malloc(3*1450*900*sizeof(char));
Comments
Post a Comment