"%s" is the default parsing format of a string in scanf(). "%s" does not include blanks or tabs etc. Here we need an end of sentence character like full stop or $ or new line (\n) to tell scanf() that we are at the end of an input. Some compiler also supports "%[...]" to scan blanks and tabs in the string. Let us see an example where user types in a sentence and gives full stop at the end.
Example Code: int main(int argc, char *argv[]) { char string[20]; printf("Enter the sentence, end with full stop or dot \n: "); scanf("%[^.]", string); }
About our authors: Team EQA
You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.
Most popular
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Calculate weighted average
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Calculate weighted average