TheAlgorithms-C/data_structures/dynamic_array/main.c

35 lines
550 B
C
Raw Normal View History

2020-04-15 06:16:22 +03:00
#include <stdio.h>
#include <stdlib.h>
#include "dynamic_array.h"
2020-04-15 06:16:22 +03:00
int main()
{
dynamic_array_t *da = init_dynamic_array();
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);
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;
}