-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.c
43 lines (32 loc) · 1.05 KB
/
example.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* @Name: ArrayList C
* @Author: Max Base
* @Date: 2022/12/02
* @Repository: https://github.com/basemax/ArrayListC
*/
#include "ArrayList.h"
int main(int argc, char** argv)
{
// Create an array list with maximum 10 value capacity.
ArrayList* list = ArrayCreate(10);
// Append a value to the last of the array list.
ArrayAppendLast(list, 10);
ArrayAppendLast(list, 20);
ArrayAppendLast(list, 30);
ArrayAppendLast(list, 40);
// Append a value to the first of the array list.
ArrayAppendFirst(list, 5);
// Append a value to the array list at the specified index.
ArrayAppend(list, 25, 2);
// Print the array list.
ArrayPrint(list);
// Delete a value from the array list at the specified index.
ArrayDelete(list, 3);
// Delete a value from the first of the array list.
ArrayDeleteFirst(list);
// Delete a value from the last of the array list.
ArrayDeleteLast(list);
// Print the array list.
ArrayPrint(list);
return 0;
}