C语言之不能在scanf中使用换行

#include<stdio.h>
#include<iostream>

int main() {
    char* str[10];
    printf("请输入:
");
    scanf("%s
", str);
    printf("您的输入是:%s
",str);
    system("pause");
    return 0;
}

如果在scanf中使用换行符,那么会在命令行进行输入时要输入两次。

原因:在scanf中随意使用 ,表示忽略一切空白符直至下一个非空白符出现。

原文地址:https://www.cnblogs.com/xiximayou/p/12128937.html