What I need to do is to receive an array a number and the index.And I try to create a function *insertc(char str, char c, int n) but it seems that the loop has some problems that it couldnot to append and somehow export an irregular row.Like this.Help me!
#include<stdio.h>
char str[10];
void insertc(char *str, char c, int n)
{ int m=sizeof(str)+1;
char *p=str;
for(int i=m-1;i>n-1;i--)
str[i+1]=str[i];
*(p+n-1)=c;
}
int main(){
char c;int a;
gets(str);
scanf("%c\n%d",&c,&a);
insertc(str,c,a);
puts(str);
return 0;
}