- How to scan a string till we hit a new line using scanf()?
scanf("%[^\n]", address); //Enter any character till newline is pressed
- What does scanf do here?
char s[12];
scanf(" \"%[^\"]\"",s);
First it checks for the leading white space and discards it.Then it matches
with a quotation mark and then it reads all character upto another
quotation mark.
No comments:
Post a Comment