c语言 vs2013 安全检查

今天学习到了字符串和字符串函数

源码

#include <stdio.h>
//#define _CRT_SECURE_NO_WARNINGS
#define MSG "You must have many talents.Tell me some."//一个符号字符号常量

#define LIM 5
#define LINELEN 81

int main(void)
{
    char name[LINELEN];
    char talents[LINELEN];
    int i;
    const char m1[40] = "Limit yourself to one line's worth.";
    const char m2[] = "If you can't think of anything. fake it.";
    const char *m3 = "\nEnough about me - what's your name?";
    const char *mytal[LIM] = { "Adding numbers swiftly",
        "Multiplying accurately", "Stashing data",
        "Following instructions to the letter",
        "Understanding the C language" };

    printf("Hi! I'm Clyde the Computer.""I have many talents.\n");

    printf("Let me tell you some of them.\n");
    puts("What's were they? Ah, yes, here's a partial list.");
    for (i = 0; i < LIM; i++)
        puts(mytal[i]);
    puts(m3);
    gets(name);
    printf("Well, %s, %s\n", name, MSG);
    printf("%s\n%s\n", m1, m2);
    gets(talents);
    puts("Let's see if I've got that list:");
    puts(talents);
    printf("Thanks for the information, %s.\n", name);

    getchar();

    return 0;

}


这样的代码在VS2013中是错误的,必须加上#define _CRT_SECURE_NO_WARNINGS而且必须加在代码的最顶端 不然还是会报错。




今天看到一句话是一位教授说,对于一种编程语言当你敲了十万行有效执行代码的时候你才算精通了这门语言,三万行算是熟悉这门语言了,受教啊。还差的很远呢。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值