The provided algorithm works (on a statically allocated array)
only if the allocated memory for the array is bigger than its current (logical) size.
e.g.
int a[20];
int size = 0;
a[0] = 5; size++;
a[1] = 7; size++;
a[2] = 2; size++;
intert(1,4); size++;
If you allocate dynamically the array (using, for instance,
malloc[
^] function) then you may use, when needed, the
realloc[
^] function to increase the buffer.
Please note: