This commit is contained in:
nonstriater
2014-05-18 21:02:31 +08:00
parent 98ed4336bc
commit 90bf14f6d3
6 changed files with 36 additions and 14 deletions
+4 -8
View File
@@ -3,17 +3,12 @@
#include <stdio.h>
int main()
{
char str[80];
scanf("%[^/n]",str);
printf("%s\n",str);
return 0;
char c;
scanf("%c",&c);
printf("%c\n",c);
scanf("%c",&c);
scanf(" %c",&c);
printf("%c\n",c);
return 0;
@@ -24,8 +19,9 @@
scanf("%c",&c) 和 scanf(" %c",&c) 区别
使用第二个scanf("%c",&c) 时,系统会将前一个scanf()输入的回车符号读入改变量。
这里为什么加一个“空格”就可以?
scanf带“空格”后,会从输入缓冲区中skip 空白符(空格、tab,换行符),读取一个字符
*/