Here is the code:
Here is some sample output:Code:// set the array with values of 0 for (int index = 0; index < NumElements -1; index++) { OriginalArray[index] = 0; } // forget about pure random at the moment for (int index = 0; index < NumElements -1; index++) { OriginalArray[index] = rand() % NumElements; } // stub for displaying numbers for (index = 0; index < NumElements -1; index++) { cout << OriginalArray[index] << '\t'; } // copy the OriginalArray to the global RandomArray memcpy(RandomArray, OriginalArray, NumElements-1); cout << "\n\n\n\n"; // stub for displaying numbers for (index = 0; index < NumElements -1; index++) { cout << RandomArray[index] << '\t'; }
What the? - roveCode:6 4 3 9 6 4 1 0 6 // after 'copy' 6 4 3 0 0 0 0 0 0
I cant figure out what is wrong, anyone see anything i cant?



LinkBack URL
About LinkBacks



saved me lots of headaches.