I am trying to take string input in an infinite while
loop that saves the string in the same array every time, but I wish this loop to terminate when I press Enter
The code looks something like this:
int main()
{
char input[1000];
while (1)
{
scanf("%s",input);
if (input[0] == '\n'){ break; } //the problem is that scanf never gets the \n
else{...}
}
return 0;
}