C语言实现数据结构顺序表
#include"node.h"
#include<stdio.h>
#include<stdlib.h>
typedef struc_list{
Node* head;
}List;
void add(Node *head,int number);
int main(){
List list;
int number;
list.head=NULL;
do{
scanf("%d",&number);
if(number!=-1){
head = add(&list,number);
}
}while(number!=-1);
return 0;
}
void add(List* pList,int number){
Node *p=(Node*malloc(sizeof(Node));
p->value=number;
p->next=NULL;
Node *last=pList->head;
if(last){
while(last->next){
Slast=last->next;
}
last->next=p;
}else{
pList->head=p;
}
}