Add function to vector and array to get data

Add a function "get_data" to vector and array which lets the user access the data pointer which the vector and array operate on.
This commit is contained in:
Bailey Thompson
2018-01-01 18:42:30 -05:00
committed by GitHub
parent 3d3bae7764
commit 7b18182e47
23 changed files with 90 additions and 70 deletions

View File

@@ -23,10 +23,14 @@ void test_array(void)
assert(g == i);
}
int arr[10] = {0};
array_to_array(arr, a);
array_copy_to_array(arr, a);
for (int i = 0; i < 10; i++) {
assert(arr[i] == i);
}
int *data = array_get_data(a);
for (int i = 0; i < 10; i++) {
assert(data[i] == i);
}
a = array_destroy(a);
assert(a == NULL);
}