int * best = new int[numNodes];
memset(best,numeric_limits<int>::max()/2,numNodes*sizeof(int));
int test = numeric_limits<int>::max()/2;
printing out the array gives me an array of all -1.
printing out the int ‘test’ gives me the correct value of ‘1073741823’
I am including ‘cstring’ for the use of memset.
Here is the doc I am following:
http://www.cplusplus.com/reference/clibrary/cstring/memset/
Why am I getting this result? I am sure it might be something obvious, I just don’t see it.
memset fills the memory with an unsigned char: