运行到这里中断了 不知道为什么。。求帮助
程序代码:void insert_flight(fly *&P, char *plane_num, char *city1, char *city2, char *time1, char *time2, int plane_room, float price, float zhekou, int sit)
{
fly *q ;
fly *p = P;
q = (fly*)malloc(sizeof(fly));
strcpy_s(q->plane_num, plane_num);
strcpy_s(q->city1, city1);
strcpy_s(q->city2, city2);
strcpy_s(q->time1, time1);
strcpy_s(q->time2, time2);
q->plane_room = plane_room;
q->price = price;
q->zhekou = zhekou;
q->sit = sit;
//q->next = NULL;
q->next = p->next;// 运行到这一句中断了【0x000A2D2B 处有未经处理的异常(在 飞机订票系统01.exe 中): 0xC0000005: 读取位置 0x0000006C 时发生访问冲突。】
p->next = q;//如果把上一句注释掉用q->next=null,到这一句就中断了。。好蛋疼
printf("hello");
p = p->next;
}
我的目的是想在表尾插入数据,,参考了书上的例子。。不知道问题在哪里。。求帮助




