如何在多行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 带狗狗训练
4 听力训练狗狗
6 怎训练狗狗
7 腹肌训练狗狗
8 网球训练狗狗
9 记叙文训练狗狗
10 狗狗太凶怎么训练
11 核心力量训练狗狗
12 狗狗乱叫怎么训练
13 发音训练狗狗
14 怎么训练狗狗叼东西给主人
15 荆州训练狗狗
16 篮球训练狗狗
17 做训练狗狗
18 训练狗狗坐姿