I have an exam on C coming up and one of the past papers has the following question:
we have this loop :
Code:for( i = 0; i < 127 && (c=getchar()) != '\n'; i++) s[i] = c ;
the question is:
If the user types in a line of text at the keyboard and presses ENTER what statement must be placed after the for loop to ensure that the array s contains a properly teminated string containing exactly what the user just entered (excluding the newline)
any help would be greatly appreciated