This will shift chars to the right, making room for insertion.
void rshift( char *s ){
int n = strlen( s);
s[ n + 1] = 0;
while( n ){
s[ n ] = s[ n-1 ];
n--;
}
}
int main(){
char *p = strchr(sentence , replace);
if( p ) {
p++; // insert after
rshift( p );
*p = insertingChar;
}
}
2
solved Insert a character at a specific position in a char array