[英]Is there any way to actually “print” \n?
在C中,字符串中的\\ n會創建新行,但是實際上有什么方法可以打印\\ n嗎?
使用轉義符\\
。
#include <stdio.h>
int main()
{
char *a = "\\n"; //String in c
printf("\\n , %s",a);
//------^Escape Character
return 0;
}
輸出:
\n , \n
還有另一種方法可以做到-
#include<stdio.h>
void main()
{
fputs("\\n",stdout);
}
這有幫助嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.