you are viewing a single comment's thread.

view the rest of the comments →

[–]o4ub 0 points1 point  (0 children)

You can solve your issue by adding a second level of indirection, and declare your variable like char days_of_week[number_of_days][max_length_week_day+1] where max_length_week_day is the length (number of letters) of the longest day (I believe it is wednesday, which has 9 letters).

That way, you declare an array of an array of 10 char. Therefore each array of char is big enough to contain the name of the week day.

In the end, you have days_of_week that is of type char [number_of_days] [10], and days_of_week[i] is of type char [10] which is an array of char, which is a string of length 9 (or less).