+
+
+/*
+ * Delete an element from an array
+ */
+void array_delete_element_at(Array *arr, int index) {
+
+ if (index >= arr->num_elements) { // If the supplied index is out of bounds, return quietly.
+ return;
+ }
+
+ --arr->num_elements;
+
+ if (index == arr->num_elements) { // If we deleted the element at the end, there's no more to be done.
+ return;
+ }
+
+ memcpy(
+ (arr->the_elements + (index * arr->element_size)),
+ arr->the_elements + ((index+1) * arr->element_size),
+ (arr->num_elements - index) * arr->element_size
+ );
+}