How many times would you have to call delete to properly fre…
How many times would you have to call delete to properly free all memory allocated by the following? struct MyObject{ int *somedata;}MyObject *someObjects = new MyObject[10];for (int i = 0; i < 5; i++) someObjects[i].somedata = new int[20];
Read DetailsGiven the following code, what will the output be? void Extr…
Given the following code, what will the output be? void ExtractValues(const vector &src, vector &out, int threshold){ int i = 0; while (i < src.size()) { if (src[i] > threshold) out.push_back(i); i++; }}int main(){ vector numbers; numbers.push_back(2); numbers.push_back(4); numbers.push_back(6); numbers.push_back(12); numbers.push_back(1); numbers.push_back(8); numbers.push_back(7); vector results; ExtractValues(numbers, results, 4); for (unsigned int i = 0; i < results.size(); i++) cout
Read Details