顺序表的创建

数据结构脑图:

数据结构脑图(部分)

创建一个顺序表:

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;
}
相关推荐
写后端的胖头鱼6 小时前
一文详解B+树原理(附场景+示例)
数据结构·b树
All for pursuit.9 小时前
【位运算-1】338.比特位计数
数据结构·c++·算法·leetcode
xxwl58511 小时前
数据结构知识点和代码实现总结(C语言实现)
c语言·开发语言·数据结构
mokongJ16 小时前
17 份异构销售数据的合并清洗方案:30 万行处理耗时 9.64 秒
数据结构
蛋蛋的就会顺顺的17 小时前
hot100——二叉树
java·数据结构·算法·leetcode·力扣
List<String> error_P19 小时前
freertos数据结构--链表
数据结构·链表
longlongzihan20 小时前
LeetCode 128. 最长连续序列 —— 从排序到哈希集合
数据结构·c++·算法·leetcode·排序算法·哈希表
mmmmath_320 小时前
二叉树の一些知识
数据结构·算法
程序员清风20 小时前
数据类型转换与日期时间处理
数据结构·pandas
Logic1011 天前
C语言/数据结构位运算题解:异或XOR找出英雄队伍中的“独特战斗力“——只出现一次的数字
c语言·数据结构·数组·位运算·时间复杂度·算法题·异或性质