I'm in need of some help here, i have a function that is supposed to return the name of the current month.
When i use the <ctime> header and SYSTEMTIME, i get the current month as a number, so i wrote a function to return the name of the month:
Now, if i write the following code in my main program:Code:#ifndef MONTH_H #define MONTH_H #include <ctime> void monthcheck(char * currentmonth[10]) { SYSTEMTIME time; GetSystemTime(&time); switch (time.wMonth) { case 1: *currentmonth = "January"; break; case 2: *currentmonth = "February"; break; case 3: *currentmonth = "March"; break; case 4: *currentmonth = "April"; break; case 5: *currentmonth = "May"; break; case 6: *currentmonth = "June"; break; case 7: *currentmonth = "Juli"; break; case 8: *currentmonth = "August"; break; case 9: *currentmonth = "September"; break; case 10: *currentmonth = "October"; break; case 11: *currentmonth = "November"; break; case 12: *currentmonth = "December"; break; } } #endif
I get the compile error: cannot convert `char (*)[10]' to `char**' for argument `1' to `char monthcheck(char**)'Code:char currentmonth[10]; char (*pcurrentmonth)[10] = ¤tmonth; monthcheck(pcurrentmonth);
I'm not very good with pointers, but Google told me that this is the way it should look, am i right?
I've tried everything, what am i doing wrong?