0
Hello people.... I have a question, why we use scanf(" %[^\n]) and another one ,scanf("%[^\n]%*c)
2 Réponses
+ 2
Hiriharan V M EEE
If I understand this syntax correctly. Then in the first case the code would be taking a characters on a line up until the newline.
The second case wouldbe similar except then the last character would also be consumed, however it would not be assigned.
So I would expect the second scanf to read all the characters up until the newline, then consume and discard the newline to clear the input buffer.
+ 1
Yeah ur near to the answer but it's not clear ... The Darkness