Array ADT
Implementation of append, insert, delete and display function in an array.
Creating a Structure for Array
struct Array {
int A[20];
int length;
int size;
}Appending to the End
void append(struct Array *arr, int value) {
// Check if there is enough space to append
if (arr -> length < arr -> size) {
// Set desired value the last index and increment length
arr -> A[length++] = value;
}
}Inserting at a Specific Index
Deleting from Specific Index
Last updated