Check the following program to see how newline character can be accepted in the scanf
printf("Enter Paragraph : ");
Enter Paragraph :
QueryHome is a
Good source of
scanf("%[^t]",para); Here scanf will accept characters entered with spaces. It also accepts the Words , new line characters. [^t] represent that all characters are accepted except tab(t) , whenever tab is encountered then the process of accepting characters will be terminated.
Paragraph Size cannot be estimated at Compile Time and vulnerable to buffer overflows.
How to Specify Maximum Size to Avoid Overflow ?
// Accepts only 100 Characters