i am trying to stop the first for loop when the user ONLY inputs "enter" and then display the current array. I am trying to use "while (Names[i] != '\n')", but it its not working.
1 2 3 4 5 6 7 8 9 10
for (i = 0; i < MaxNumNames; i++)
{
cout << "Enter a name: ";
Names[i] = ReadString();
}
while (Names[i] != '\n')
for (i = 0; i < MaxNumNames; i++)
cout << Names[i] << endl;
Since you haven't shown the code for ReadString, it's unclear what the pointer it returns points to. Since it is called multiple times, it should be allocating a new char array on each call (unlikely).
Line 24: You're comparing a pointer to '\n'. You're not comparing a character of the name.