int *arr = new int[3];
arr[0] = 1;
arr[2] = 3;
for (int i = 0; i < arr.size(); i++)
{
if(arr[i] exists/initialized) // what would be the condition?
std::cout << arr[i] << " ";
}
I'm trying to print elements from the array that are initialized, and ignore elements that aren't.
So, the above code would print out:
1 -1231409875 3
I want to fix this so that it outputs:
1 3