#include <stdio.h>
#include <stdlib.h>
void main()
{
char str[30],str1[30],str2[50];
int i,n,j,k;
printf("enter the string: ");
fgets(str,sizeof(str),stdin);
printf("enter the inserting string: ");
fgets(str1,sizeof(str1),stdin);
printf("enter the position: ");
scanf("%d",n);
for(i=0,k=0;i<n;i++,k++)
str2[k]=str[i];
for(j=0;str1[j]!='\0';j++,k++)
str2[k]=str[j];
for(i=n;str[i]!='\0';i++,k++)
str[k]=str[i];
printf("%s",str);
}
no errors for example output will be like this
enter the string:rohinnj
enter the inserting string:kumar
enter the position to be inserted:5
the inserted string is:rohinnkumarj