When compiling any program, pay attention to the warnings that the compiler emits.
For each of the warnings, you have to understand why it is given and how to fix it properly.
$ gcc -std=c99 insort.c
insort.c:7:9: warning: implicit declaration of function 'atoi' [-Wimplicit-function-declaration]
insort.c:11:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
To fix these, insert the following lines at the very top:
#include <stdio.h> // for printf
#include <stdlib.h> // for atoi
The next one:
insort.c:10:5: warning: implicit declaration of function 'insort' [-Wimplicit-function-declaration]
To fix it, move the whole insort function above the main function.
The next one:
insort.c:23:17: warning: assignment makes integer from pointer without a cast
This one is really bad. The parameter int *A[] really means int **A, which is a pointer to a pointer to int. To fix this, remove the square brackets.
The next one:
insort.c:22:12: warning: passing argument 1 of 'insort' from incompatible pointer type
The & operator is not necessary. When you pass an array to a function, it decays into a pointer to the beginning of the array. Remove the &.
Now, the program compiles without giving any warnings. That’s good. Next level:
$ gcc -std=c99 -Wall -Wextra -Os insort.c
Wow. Even with all these warnings enabled, the compiler doesn’t complain anymore. That’s good.
(The -Os optimization option is necessary to enable some of the warnings, since they are only tested for when the compiler optimizes the code.)
Now the program compiles. When running it, it seems to be stuck in an endless loop. But the worst errors are fixed now.
argcandargv, it makes the program unreadable.