最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

错误C4996‘scanf‘: This function or variable may be unsafe. Consider using scanf_s instead.(已解决)

业界 admin 3浏览 0评论

解决问题:
    错误C4996'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

#define _CRT_SECURE_NO_WARNINGS 1

将上方代码放置在第一行(不放置在第一行不生效)

#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main() {
    int a = 0;
    int b = 0;
    int sum = 0;
    scanf("%d %d",&a ,&b);
    sum = a + b;
    printf("sum = %d\n", sum);
    return 0;
}

解决问题:
    错误C4996'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

#define _CRT_SECURE_NO_WARNINGS 1

将上方代码放置在第一行(不放置在第一行不生效)

#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main() {
    int a = 0;
    int b = 0;
    int sum = 0;
    scanf("%d %d",&a ,&b);
    sum = a + b;
    printf("sum = %d\n", sum);
    return 0;
}

与本文相关的文章

发布评论

评论列表 (0)

  1. 暂无评论