[C]struct初识

 

#include <stdio.h>
#include <string.h>
struct date
{
    int day;
    //int month;
    char month[10];
    int year;
}; //别丢掉这里的逗号

int main()
{
    struct date today;
    today.day = 4;
    //today.month = 6;
    strcpy(today.month, "May");
    today.year = 2020;
    printf("Today is %s-%d-%d\n", today.month, today.day, today.year);
    return 0;
}

 

posted @ 2020-06-04 16:16  profesor  阅读(101)  评论(0编辑  收藏  举报