顺序表的创建

数据结构脑图:

数据结构脑图(部分)

创建一个顺序表:

seqList.h

#ifndef SEQLIST_H

#define SEQLIST_H

/*

struct sequence seqList{

int data30;

int len;

};

*/

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

#define MAX 30

typedef int Datatype;

typedef struct sequence

{

Datatype dataMAX;

int len;

}seqList,*seqListptr;

seqListptr seq_create();

#endif

seqList.c

#include<stdio.h>

#include"seqList.h"

seqListptr seq_create()

{

seqListptr S =(seqListptr)malloc(sizeof(seqListptr));

if (NULL==S)

{

printf("创建失败\n");

return NULL;

}

else

{

printf("创建成功\n");

S->len;//len会生成随机数需要清空

memset(S->data,0,sizeof(S->data));

return S;

}

}

main.c

复制代码
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "seqList.h"
int main(int argc, const char *argv[])
{
	
	seqListptr A=seq_create();
	return 0;
}
相关推荐
老师我太想进步了20262 小时前
【数据结构-3】算法美学之降复杂度
数据结构·算法
w_zero_one14 小时前
算法--构造
java·数据结构·算法
lisw0517 小时前
互联网上的数据结构可视化!
数据结构·信息可视化
老师我太想进步了20261 天前
【数据结构-1】例解算法复杂度
数据结构·算法
YSL0701241 天前
一文通关-----排序
数据结构·算法
夜不会漫长2 天前
C++:红黑树
数据结构·算法
冻柠檬飞冰走茶2 天前
PTA刷题集之Airline Routes(C语言实现)
c语言·开发语言·数据结构·算法
736c2 天前
固件开发岗算法
数据结构·算法
冻柠檬飞冰走茶2 天前
PTA刷题集之Battle Over Cities - Hard Version(C语言实现)
c语言·开发语言·数据结构·算法
PaperAccept2 天前
【研知有术论文发表】材料科学一区期刊,影响因子30+的纳米科技SCI,审稿严格但有效率
大数据·数据结构·科技·量子计算