I am trying to insert a character at a specific position in the char array (char *peep) but every time I try, I get a strcpy error
Current Code
int main(){
char *peep = malloc(256);
int pos;
char character, charToStr[2];
charToStr[1] = '\0';
printf("\nCharacter to insert: ");
scanf("%c", &character);
printf("Position to insert: ");
scanf("%d", &pos);
printf("\nPeep becomes\n%d:%c", pos,character);
charToStr[0] = character;
strcpy(peep[pos-1],charToStr);
printf("this is peep: \n%d:%c",pos,peep[pos-1]);
}
I have tried using strncpy() to no avail and honestly tried many other things