1.思维导图
2.顺序表的创建
seq.h
cs
#ifndef __SEQ_H__
#define __SEQ_H__
#define max 30
typedef int DataType;
typedef struct
{
DataType data[max];
int len;
}seqList,*seqListPtr;
seqListPtr seq_create();
#endif
seq.c
cs
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include"seq.h"
seqListPtr seq_create()
{
seqListPtr p=(seqListPtr)malloc(sizeof(seqList));
if(NULL==p)
{
printf("创建失败\n");
return NULL;
}
printf("创建成功\n");
p->len=0;
memset(p->data,0,sizeof(p->data));
return p;
}
main.c
cs
#include <stdio.h>
#include <stdlib.h>
#include"seq.h"
int main(int argc, const char *argv[])
{
seqListPtr p = seq_create();
return 0;
}
输出结果: