(scroll down to see the codes)

I am writing a programme to read chars and output the new chars with continuous spaces being eliminated until one( say 'tes t' gonna to be 'tes t'

And then i found that the programme can't be stopped when i gave the former input on GDB(a online compiler)

My question is that what exactly happen after i press the key 'Enter', Does that key create a '\n' at the end of the...