I have read all of the questions about these, but I have not found an explanation for the difference between %[^\\n]s
and %[^\\n]
in the scan
Adding [^\n
] in scanf()
means skip over any new line char. It consumes all apart from new line char.
The the * flag signals that no assignment should be made. In this case * char. [\n] skips over any leading newline characters
In other words: %*[^\n]
scans means everything until a \n(Doesn't scan \n) and discards.