Observe the following code:
int nums[3] = {1, 2, 3};
std::cout << nums;
What will be output to the screen?
A: 1.
B: 3.
C: 123.
D: A memory address.
#include <iostream>
using namespace std;
int main()
{
int nums[3] = { 1, 2, 3 };
std::cout << nums<<endl;
//result is D: A memory address
//because of output nums == output &nums[0]
}
Comments
Leave a comment