+ 2

What is scanf(%[^\n]s ) about String??

I found the first use in Challenge questions.Please explain me about this.

3rd Aug 2020, 7:19 AM
Aniket Gade
Aniket Gade - avatar
3 Answers
+ 3
it is used for input string Here, [] is the scanset character. ^\n tells to take input until newline doesn’t get encountered. Then, with this %*c, it reads newline character and here used * indicates that this newline character is discarded.
3rd Aug 2020, 5:10 PM
A S Raghuvanshi
A S Raghuvanshi - avatar