#include <stdio.h>
#include <stdlib.h>
struct Node{ //c语言实现结构体的创建
int data;
struct Node *next;
};
int main()
{
struct Node *p1,*head;
for(int i=0;i<10;i++)
{
p1->next=(struct Node *)malloc(sizeof(struct Node));
p1->data=i*4;
if(i==10) p1->next=NULL;
else p2->next=p1;
}
head=p1;
while(head!=NULL)
{
printf("%3d",head->data);
head=head->next;
}
return 0;
}
C语言实现结构体链表的建立
最新推荐文章于 2022-10-07 23:03:57 发布