My question is like this, there is a struct data
in test.h
struct data {
static int year[10];
static int month[12];
static int day[31];
};
In Cpp file, I have several functions which need to call it. Where and how should I initialize it?
void test::display(){
struct data pointer;
/* ... */
// These three arrays should be initialized
pointer.year[index1] = Timeyear;
pointer.month[index2] = Timemonth;
pointer.day[index3] = Timeday;
printf("%d %d %d", pointer.year[index1],
pointer.month[index2], pointer.day[index3]);
/* ... */
}