Break long Printf Statement Upto Multiple Lines in C :
Printf statement is used for displaying text,message or output of the program.So question is that "Can a long printf statement be broken up into multiple lines ?" Its answer is Yes we have 3 tricks by which you can break printf upto multiple lines3 ways of Multiline
- Using "Backward Slash".
- Using "Double Quotes"
- By Dividing Printf into Many Small Printf's
1 . Using "Backward Slash".
Output :#include<stdio.h> void main() { printf("C Programming is \ funny Language "); }
C Programming is funny LanguageNote :
- One printf can be broken into 'n' number of lines using "Backslash"
- No need to Close "Double Quotes" after first line.
- Opening Double Quote always on First Line while Closing Double Quote always on Last Line.
2 . Using "Double Quotes"
Output :#include<stdio.h> void main() { printf("C Programming is " "funny Language "); }
C Programming is funny LanguageNote :
- Each Line needs Opening and Closing "Double Quote".
3 . Break Long Printf in Small PRintf's
Output :#include<stdio.h> void main() { printf("C Programming is "); printf("funny Language "); }
C Programming is funny Language
0 Comments:
Post a Comment
Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email