69,382
社区成员
发帖
与我相关
我的任务
分享
struct Node *create(int n)
{
int i = 0;
struct Node *head = NULL, *p;
for (i = 0; i < n; i++ )
{
p = (struct Node *)malloc( sizeof(struct Node) );
if ( p )
{
printf("Input the dat of the %d Node : ", i+1);
scanf("%d", &p->dat);
p->next = head;
head = p;//////////////////////指针不是地址吗,相等怎么理解?
}
else
{
printf("Memory is not enough for malloc.\n");
break;
}
}
return head;
}