#include <stdio.h>
/* replacing tabs and backspaces with visible characters */
int main()
{
int c;
while ( (c = getchar() ) != EOF) {
if ( c == '\t')
printf("\\t");
else if ( c == '\b')
printf("\\b");
else if ( c == '\\')
printf("\\\\");
else
putchar(c);
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
现在我的问题是..为什么我不能在输出中看到"\ b"?我已经在Ubuntu终端中编写了这段代码.有什么其他方法可以在输出中获得"\ b"字符吗?如果有,请用简单的词语解释,因为我刚开始学习C编程.这个例子来自K&R练习1-10.
我已经开始学习C了,我也开始使用Ubuntu.我正在通过终端在vim中编写代码.我一直在学习Kernighan和Ritchie.这是代码 -
#include <stdio.h>
int main()
{
int c;
while ( (c = getchar()) != EOF)
putchar(c);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
现在,我的问题是: -