c出错。不懂怎么修改
#include <stdio.h>#include <stdlib.h>
#define MAX_NAME 11
#define MAX_DETAIL 21
#define MENU_COUNT 9
#define DATE_FILE "fs.dat"
typedef enum _fi_type
{
income=1,
payout=-1
}fi_type;
typedef struct _fi_info
{
int year;
int month;
fi_type type;
char name[MAX_NAME];
float money;
char detail[MAX_DETAIL];
}fi_info;
typedef struct _fi_data
{
fi_info info;
struct _fi_data* next;
}fi_data;
fi_data* head;
char menu[]=
"=============================================================\n"
"|家庭财务管理系统 |\n"
"|+----------------------------------------------------------+\n"
"|收入管理 |\n"
"| <1>添加收入 |\n"
"| <2>查询收入明细 |\n"
"| <3>删除收入 |\n"
"| <4>修改收入 |\n"
"|支出管理 |\n"
"| <5>添加支出 |\n"
"| <6>查询支出明细 |\n"
"| <7>删除支出 |\n"
"| <8>修改支出 |\n"
"|统计 |\n"
"| <9>统计总收入总支出 |\n"
"|+----------------------------------------------------------+\n"
"|输入<0>退出 |\n"
"|+----------------------------------------------------------+\n"
void (*menu_fun[])()=
{
quit,
add_income,
search_income,
delete_income,
update_income,
add_payout,
search_payout,
delete_payout,
update_payout,
count_total
};
void add_income()
{
fi_data* p=(fi_data*)malloc(sizeof(fi_data));
memset(p,0,sizeof(fi_data));
p->next=NULL;
input_info(&(p->info));
p->info.type=income;
if(head==NULL)
{
head=p;
}
else
{
get_last(head)->next=p;
}
}
void search_income()
{
search_data(income);
}
void delete_income()
{
delete_data(income);
}
void update_income()
{
update_data(income);
}
void add_payout()
{
fi_data* p=(fi_data*)malloc(sizeof(fi_data));
memset(p,0,sizeof(fi_data));
input_info(&(p->info));
p->info.type=payout;
if(head==NULL)
{
head=p;
}
else
{
get_last(head)->next=p;
}
}
void search_payout()
{
search_data(payout);
}
void delete_payout()
{
delete_data(payout);
}
void update_payout()
{
update_data(payout);
}
void count_total()
{
float total_income=0.0;
float total_payout=0.0;
fi_data* p=head;
while(p!=NULL)
{
if(p->info.type==income)
{
total_income+=p->info.money;
}
else
{
total_payout+=p->info.money;
}
p=p->next;
}
printf("+----------------------------------------------------+\n");
printf("| 合计收入 | 合计支出 | 结余 |\n");
printf("+----------------------------------------------------+\n");
printf("|%12.2f |%12.2f |%12.2f |\n",total_income,total_payout,total_income-total_payout);
printf("+----------------------------------------------------+\n");
printf(">按任意键返回主菜单……");
fflush(stdin);
getchar();
}
void quit()
{
save_to_file();
clear_data();
exit(0);
}
int main()
{
int selected=0;
initialize();
while(selected>=0&&selected<=MENU_COUNT)
{
system("cls");
printf(menu);
printf(">请选择要进行的操作(%d——%d):",0,MENU_COUNT);
if(scanf("%d",&selected)!=1||selected<0||selected>MENU_COUNT)
{
printf(">输入错误!请选择(%d——%d)之间的数字!按任意键重试……",0,MENU_COUNT);
fflush(stdin);
getchar();
}
else
{
menu_fun[selected]();
}
selected=0;
}
}
运行错误Declaration syntax error
pointer required on left side of->in function add_income
pointer required on left side of->in function add_payout
undefined symbol'menu_fun'in function main
Invalid indirection in function main
出现这些错我
不懂得怎么修改
请各位指导一下