我有一个菜单和子菜单。我创建了一个结构,其中我将菜单和子菜单名称存储在一个数组中。试图打印它们,但我认为我在某个地方错了。
#include <stdio.h>
#include <stdlib.h>
struct calculator
{
int x_loc;
int y_loc;
char main_menu[15];
char sub_menu[15];
char icon_title[100];
};
char *main_menu_names[3] = {"Link_1", "Link_2", "Link_3"};
char *sub_menu_names[3] = {"Sub_Link_1", "Sub_Link_2", "Sub_Link_3"};
struct calculator info = {219, 120, main_menu_names, sub_menu_names, "Title"};
int main()
{
printf("X location: %d\n",info.x_loc);
printf("Y location: %d\n",info.y_loc);
printf("Menu Name: %s\n",info.main_menu);
printf("sub menu: %s\n",info.sub_menu);
printf("icon_title: %s\n",info.icon_title);
system("PAUSE");
return 0;
}