表数据驱动之直接访问

#include "stdafx.h"
#include <stdio.h>
#include <string.h>
#include <math.h>
#include<stdlib.h>
#include <dos.h>
#include <conio.h>

typedef struct _Month_Times
{
    int days;

}Month_Times;

Month_Times mount_times[] = 
{
    {31},
    {28},
    {31},
    {30},
    {31},
    {30},
    {31},
    {31},
    {30},
    {31},
    {30},
    {31},
};

int main()
{

    int cur_month = 2;

    printf(" month days is %d\n ",mount_times[cur_month-1].days);

    getchar();

    return 0;
}

 

posted @ 2020-05-04 17:08  卷哭你  阅读(86)  评论(0编辑  收藏  举报