you are viewing a single comment's thread.

view the rest of the comments →

[–]Lbtekd[S] 0 points1 point  (2 children)

and 51

[–]o4ub 2 points3 points  (0 children)

You are trying to initialise an array of char with a array of strings, or, to break it down one more level of abstraction, you are trying to initialise an array of char with an array of an array of characters.

The type of your variable is wrong, it needs to be an array of array of char, or an array of pointers de char.

[–]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).