I am currently writing a C++ program on Xcode. The following is a snippet of the code I am running:
char myString[3];
cin >> myString;
cout << myString << endl;
The code is very straightforward. However, when I enter strings longer than 2 characters, the string still accepts them. Why doesn't the string only store two characters plus the null terminator?
Thanks!