HW_Lib/lib/list/inc/array.h

33 lines
753 B
C
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef HW_LIB_ARRAY_H
#define HW_LIB_ARRAY_H
#ifdef __cplusplus
extern "C" {
#endif
// 在数组的索引 index 处插入元素 num
// nums: 操作数组
// size: 数组大小
// num: 操作数
// index: 操作位置
void insert(int *nums, int size, int num, int index);
// 删除索引 index 处的元素
// nums: 操作数组
// size: 数组大小
// index: 索引位置
// 注意stdio.h 占用了 remove 关键词
void removeItem(int *nums, int size, int index);
// 在数组中查找指定元素
// nums: 操作数组
// size: 数组大小
// target: 查找元素
int find(int *nums, int size, int target);
/* 扩展数组长度 */
int *extend(int *nums, int size, int enlarge);
#ifdef __cplusplus
}
#endif
#endif //HW_LIB_ARRAY_H