I'm trying to allocate some memory as unsigned char* however when I do the pointer doesn't seem to have been initialized!
unsigned char* split = (unsigned char*) malloc ((sizeof(unsigned char)*sizeof(unsigned int)));
memset(&split,0,sizeof(int));
if(split==NULL) {
std::cout<<"Unable to allocate memory!\n";
system("pause");
return 1;
}
However every single time I run I get the error message. It seems to happen no matter what data type I use as well!
unionyet? - Ignacio Vazquez-Abramssplit == NULLbefore messing around with it, whether correct or incorrectly as you are doing here. If you usecalloc()you can get rid of thememset()altogether. - user207421