> char sentence[] = "---|abc";
Well you can't insert anything into this string, since it is already full.
It's generally easiest to use two strings
char sentence[] = "---|abc";
char new[100];
textFormatting(sentence,new,sizeof new);
Within textFormatting(), you can use things like strncpy(), strcpy(), strcat() to move bits of strings from one to the other.
I think this does it
Code:
char *p = strchr( src, '|' );
int len = p - src;
strncpy( dst, p, len );
dst[len] = '\0';
strcat( dst, "*" );
strcat( dst, p );