mirror of
https://github.com/ViolentAyang/DataStructureC.git
synced 2026-02-03 10:23:18 +08:00
Delete 静态线性表按值查找.c
This commit is contained in:
34
静态线性表按值查找.c
34
静态线性表按值查找.c
@@ -1,34 +0,0 @@
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<stdbool.h>
|
||||
#define MaxSize 10
|
||||
|
||||
typedef struct{
|
||||
int data[MaxSize];
|
||||
int length;
|
||||
}SeqList;
|
||||
|
||||
void InitList(SeqList *L){
|
||||
for(int i = 0;i < MaxSize;i ++){
|
||||
L->data[i] = 0;
|
||||
}
|
||||
L->length = 0;
|
||||
}
|
||||
|
||||
void InsertList(SeqList *L,int i ,int e){
|
||||
L->data[i] = e;
|
||||
L->length ++;
|
||||
}
|
||||
int GetElement(SeqList L,int i){
|
||||
return L.data[i-1];
|
||||
}
|
||||
|
||||
int main(){
|
||||
SeqList L;
|
||||
InitList(&L);
|
||||
for(int i = 0;i < 9; i++){
|
||||
InsertList(&L,i,i);
|
||||
}
|
||||
printf("%d\n",GetElement(L,5));
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user