上一篇
c语言输入怎么换行
- 行业动态
- 2024-03-27
- 2
在C语言中,换行可以通过两种方式实现:
1、使用转义字符`
,在需要换行的地方插入
`即可实现换行。
示例代码:
#include <stdio.h> int main() { printf("Hello, World! "); printf("This is a new line. "); return 0; }
2、使用puts
函数。puts
函数会自动在字符串末尾添加换行符`
`。
示例代码:
#include <stdio.h> int main() { puts("Hello, World!"); puts("This is a new line."); return 0; }