I am working on Xcode 14.0.1, and the following output doesn't make sense to me for the following code. How can I fix this?
int main()
{
const char arr1[6] = {'1','2','3','4','5','6'};
const char arr2[1] = {'2'};
cout << arr2 << endl;
return 0;
}
The following code outputs
2123456
Program ended with exit code: 0
Can someone please explain what is going on here?
I was expecting the output code to be
2
Program ended with exit code: 0