Home > Article > Backend Development > How to wrap lines in C language
How to wrap lines in C language: First open the code editor; then add [\r\n] at the end of each output statement. The code is [printf("Try typing a character: \r\n")].
C language line wrapping method:
1. Give a chestnut
# include <conio.h> # include <stdio.h> int main() { char ch; printf("打个字符试试:"); ch = getch(); printf("你刚输入的是:%c",ch); printf("按任意键结束"); getch(); return 0; }
We will I found that the output was on one line
2. We added \r\n
at the end of the output statement so that the output can be newline
3. Finished product
# include <conio.h> # include <stdio.h> int main() { char ch; printf("打个字符试试:\r\n"); ch = getch(); printf("你刚输入的是:%c\r\n",ch); printf("按任意键结束"); getch(); return 0; }
Related learning recommendations: C video tutorial
The above is the detailed content of How to wrap lines in C language. For more information, please follow other related articles on the PHP Chinese website!