数据结构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;
}

输出结果:

相关推荐
czlczl200209254 分钟前
算法:组合问题
算法·leetcode·职场和发展
CoderYanger6 分钟前
优选算法-字符串:63.二进制求和
java·开发语言·算法·leetcode·职场和发展·1024程序员节
Cx330❀17 分钟前
C++ STL set 完全指南:从基础用法到实战技巧
开发语言·数据结构·c++·算法·leetcode·面试
阿昭L2 小时前
堆结构与堆排序
数据结构·算法
2***57422 小时前
人工智能在智能投顾中的算法
人工智能·算法
草莓熊Lotso2 小时前
《算法闯关指南:动态规划算法--斐波拉契数列模型》--01.第N个泰波拉契数,02.三步问题
开发语言·c++·经验分享·笔记·其他·算法·动态规划
mit6.8248 小时前
bfs|栈
算法
CoderYanger9 小时前
优选算法-栈:67.基本计算器Ⅱ
java·开发语言·算法·leetcode·职场和发展·1024程序员节
jllllyuz9 小时前
Matlab实现基于Matrix Pencil算法实现声源信号角度和时间估计
开发语言·算法·matlab
稚辉君.MCA_P8_Java10 小时前
DeepSeek 插入排序
linux·后端·算法·架构·排序算法