Why this don't work? months[5] == name is equal. months[5]
is Jun
and name
is Jun
but if
never execute...
int getMonthNum(char * name){
char *months[12] ={"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
char *pointertoarray = &months;
int i;
for(i = 1; i <= 12; i++){
if(months[5] == name){
return i;
}
}
return i;
}