数据结构Day一

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;
}

输出结果:

相关推荐
weixin_307779131 小时前
C++代码实现MATLAB中的dlarray函数功能
开发语言·c++·算法·matlab
hetao17338376 小时前
2026-10-03~04 hetao1733837 的刷题记录
c++·算法
Zootopia6267 小时前
飞行力学知识梳理1|飞行性能与稳定性
人工智能·python·算法·机器学习·无人机·学习方法·信息与通信
longlongzihan7 小时前
从LeetCode 70. 爬楼梯看动态规划:如何精准推导状态转移方程?
c++·算法·leetcode·动态规划
2601_960356388 小时前
2027校招采购岗解析:数学基础如何迁移到需求预测、成本与供应商分析
人工智能·算法
h_a_o777oah9 小时前
【树论】树链剖分:将树形结构转化为线性结构以处理树上路径问题(洛谷 P3384 附C++代码模板)
数据结构·算法·线段树·acm·树链剖分·树论·重链剖分
HEJOO99 小时前
指针的算术运算详解
java·数据结构·算法
Coder-magician9 小时前
《代码随想录》刷题打卡day47:并查集-part01
数据结构·算法·图论
垆边人似月.9 小时前
VLAN 资源池(100~200 分档)
数据结构·算法
潼心1412o10 小时前
C++初阶(长期更新)第6讲:类和对象(下)
开发语言·c++·算法