如何在多行C / C ++中编写长字符串?
长字符串可以通过使用两个双引号(“”)来在中间的任意点处断开字符串来多行编写。
给出了一个用C语言演示此程序的程序,如下所示。
示例
#include <stdio.h>
int main() {
char *str = "This is the method "
"to write long strings "
"in multiple lines in C";
puts(str);
return 0;
}输出结果
上面程序的输出如下。
This is the method to write long strings in multiple lines in C
现在让我们了解上面的程序。
可以使用两个双引号(“”)将字符串str多行写入,以在中间的任意点将字符串断开。然后使用puts显示字符串。显示此代码段如下。
char *str = "This is the method " "to write long strings " "in multiple lines in C"; puts(str);
热门推荐
1 狗狗下楼训练
3 狗狗训练头盔
6 狗狗训练机构
7 训练狗狗步骤
9 狗狗能训练
10 狗狗基本动作训练方法
11 怎么训练狗狗叼饭盆
12 狗狗一岁了还能训练吗
13 训练狗狗的
14 宁波狗狗训练
15 训练狗狗拉屎
16 教狗狗训练
17 狗狗要怎么训练上厕所
18 狗狗靠的训练