2020-04-15 06:16:22 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2020-06-28 18:25:37 +03:00
|
|
|
#include "dynamic_array.h"
|
2020-04-15 06:16:22 +03:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
dynamic_array_t *da = init_dynamic_array();
|
|
|
|
|
2020-05-29 23:23:24 +03:00
|
|
|
for (int i = 1; i <= 50; i++)
|
|
|
|
{
|
2020-04-15 06:16:22 +03:00
|
|
|
add(da, &i);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete (da, 10);
|
|
|
|
|
|
|
|
int value = 1000;
|
|
|
|
|
|
|
|
put(da, &value, 0);
|
|
|
|
|
|
|
|
value = 5000;
|
|
|
|
|
|
|
|
int another_value = 7000;
|
|
|
|
|
|
|
|
add(da, &another_value);
|
|
|
|
|
2020-05-29 23:23:24 +03:00
|
|
|
for (int i = 0; i < da->size; i++)
|
|
|
|
{
|
2020-04-15 06:16:22 +03:00
|
|
|
printf("value %d\n", *(int *)get(da, i));
|
|
|
|
}
|
|
|
|
|
|
|
|
int value_for_invalid_index = 10000;
|
|
|
|
|
|
|
|
put(da, &value_for_invalid_index, 150);
|
|
|
|
return 0;
|
|
|
|
}
|