Possible Duplicate:
Passing multidimensional array to a function C
I want to pass a 2D structure to a function Here is the prototype and the definition of the function and the "typedef" of the function.
typedef struct {
BOOLEAN valid;
event_t event_list [MAXEVS];
int num_events;
} calentry_t;
calentry_t calendar[12] [31]; // The declaration of the structure
How can i create the definition of the function that i will pass to it the 2d structure and how can i pass it please can someone spot my errors
InitializeCalendar (calentry_t *calendar){
int x, y;
for(x = 0; x < 12; x ++) {
if (x==2){
for(y = 0; y <= 28; y ++){
(*calendar).calendar[x][y].valid = TRUE;
}
for (y=29; y<= 31; y++){
(*calendar[x][y]).valid = FALSE;
}
}
else if (x==4 || x==6 || x==9 || x==11){
for(y = 0; y <= 30; y ++){
(*calendar[x][y]).valid = TRUE;
}
for (y=30; y<= 31; y++){
(*calendar)[x][y].valid = FALSE;
}
}
}
}