mirror of
https://github.com/bkthomps/Containers.git
synced 2025-12-29 10:30:50 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user