Reputation: 1108
Code:
char menu_list[] = {'Boiled egg', 'Corn flakes', 'Gobi 65', 'Chicken 65', 'Basandi'};
Am a new to c programming i just wanted to make an array of string, but am getting an waring as below. can anyone please tell me why its happening. Its a c program.
main_menu.c:226: warning: large integer implicitly truncated to unsigned type
main_menu.c:226:36: warning: character constant too long for its type
Upvotes: 1
Views: 34782
Reputation: 307
Change char menu_list[]
to char * menu_list[]
and use "Boiled egg"
rather than 'Boiled egg'
.
The final code should look like
char *menu_list[] = {"Boiled egg", "Corn flakes"};
Upvotes: 1
Reputation: 4808
You should use double quotes for string lliteral, and you are wrongly declaring the array.
Perhaps you are looking for thiss.
char *menu_list[] = {"Boiled egg", "Corn flakes", "Gobi 65", "Chicken 65", "Basandi"};
Upvotes: 12