丢弃scanf中不需要的空白区域

控制字符串中的空格字符会导致scanf()跳过一个或多个前导空白字符。空白字符可以是空格,制表符,垂直制表符,换页符或换行符。控制字符串中的一个空格字符会导致scanf()跳过任何数字,包括零空格字符。

#include <stdio.h>

int main(void)
{
   int i;
   char str[80], str2[80];

   printf(skip white space testing, input one integer, two strings and lots of space in between.\n);

   scanf(%d %s %s, &i, str, str2);

   printf(%d %s %s, i, str, str2);

   return 0;
}

相关文章

for遍历数组
。。。
声明一个计数循环
咕咕咕
#include <stdio.h> int main (void) { printf (&quo...