- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to write long strings in Multi-lines C/C++?
Long strings can be written in multiple lines by using two double quotes ( “ “ ) to break the string at any point in the middle.
A program that demonstrates this in C is given as follows.
Example
#include <stdio.h> int main() { char *str = "This is the method " "to write long strings " "in multiple lines in C"; puts(str); return 0; }
Output
The output of the above program is as follows.
This is the method to write long strings in multiple lines in C
Now let us understand the above program.
The string str can be written in multiple lines by using two double quotes ( “ “ ) to break the string at any point in the middle. Then the string is displayed using puts. The code snippet that shows this is as follows.
char *str = "This is the method " "to write long strings " "in multiple lines in C"; puts(str);
Advertisements