There is basically one problem that makes the code not to work.
The problem is that in your code you assign the following way:
char* ip = &insert;
when it really should be:
char* ip = insert;
The variable insert is not an array. It's a pointer to a spot allocated for the program. Basically - it's just a pointer to the first element in the array.
Means:
insert[0] = 'a';
is the same as:
*insert = 'a';
So the address of insert is a pointer TO THE POINTER that points to the array.
You could either just put a * operator TWICE (** - something like 'the content of the content of...[some variable which is usually a pointer]) before the ip in the strcat use OR you could just type strcat(str, insert); because in this program there is no need for the variable ip at all.
One more mistake is not saving room for the NULL terminator \0 that announces the end of a string.
So either you type char insert[] = "insert "; which determines the size of the array according to the direct assignment OR you could do char insert[8] = "insert "; which is basically the size of that string (it needs a NULL terminator so it's 'i', 'n', 's', 'e', 'r', 't', ' ' and '\0').
char* ip = &insert;instead of justinsertif you are not doing any arithmetic with the pointer?strncatandstrncpywhenever you can, it's safer