表数据驱动之直接访问

#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
 ",mount_times[cur_month-1].days);

    getchar();

    return 0;
}
一勤天下无难事。
原文地址:https://www.cnblogs.com/nowroot/p/12827214.html