【数据结构】【Access violation】【数据结构】【C语言】问题求助!!!!
请高人指点,下面是创建单链表的一段程序,我在输入:11 回车 12 回车 后则出现错误提示Unhandled exception at 0x00411450 in Create_Print_Free.exe: 0xC0000005: Access violation writing location 0xcdcdcdd1.不知为何?程序代码:
#include <stdlib.h> #include <stdio.h> #define MAX 10 struct list { int Num; int Data; struct list *Next; }; typedef struct list Node; typedef Node *Link; void Create_List(Link Head,int n); void main () { Link Head; Head=(Link)malloc(MAX*sizeof Node); Create_List(Head,MAX); } void Create_List(Link Head,int n) { //int Data1; printf("Please input Datas:\n"); for (int i=0;i<n;i++) { scanf("%d",&(Head->Data)); //Head->Data=Data1; Head->Num=i; Head=Head->Next; //fflush(stdin); } }