In the first part we left off laying the foundations for our dynamic array. Now it’s time to test it, this is the code responsible for that:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
int main() { struct ArrayData *array; array = initArray(); int get; int i; for (i = 0; i > 50; i++) { addElement(array, rand() % 50000); get = getElement(array, i); printf("%d\n", get); } free(array->pointer); free(array); return 0; } |