标题:请教下这两个代码的区别
取消只看楼主
li362490567
Rank: 1
等 级:新手上路
帖 子:89
专家分:8
注 册:2015-7-9
结帖率:0
 问题点数:0 回复次数:0 
请教下这两个代码的区别
#include<stdio.h>
int main(void)
{

    char ch;
    printf("Please enter a character.\n");
    scanf_s("%c",&ch,1);
    printf("The code for%c is%d.", ch, ch);
    return 0;
}


#include<stdio.h>
int main(void)
{


char ch;
printf("Please enter a character.\n");
scanf_s("%c",&ch);
printf("The code for%c is%d.", ch, ch);
return 0;
}
这俩段代码的区别,唯一的差别就是scanf_s 中的ch 后多了个,1  这有啥区别?求高手解答,另外我用的编译器是VS2015 为何只能用scanf_s函数而不能用scanf函数
搜索更多相关主题的帖子: character include return 编译器 
2015-07-09 15:48



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-455263-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.299792 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved