C Program to Accept Paragraph using scanf

Accept Paragraph using scanf in C

Output :[Press Tab to Stop Accepting Characters ]

How ?

  1. Here scanf will accept Characters entered with spaces.
  2. It also accepts the Words , new line characters .
  3. %[^\t]s  represent that all characters are accepted except tab(t) , whenever t will encountered then the process of accepting characters will be terminated.

Drawbacks :

  1. Paragraph Size cannot be estimated at Compile Time
  2. It’s vulnerable to buffer overflows.

How to Specify Maximum Size to Avoid Overflow ?

Output :

Download PDF :

Click Here