#include<stdio.h>
#include <string.h>
#define MAX_SIZE 10

char string1[MAX_SIZE], *s = string1;
char string2[MAX_SIZE], *t = string2;

void strnins(char *s, char *t, int i){

  char string[MAX_SIZE], *temp =string;
  
  if(!strlen(s)) strcpy(s,t);
  else if (strlen(t)){
    strncpy(temp,s,i); //strncpy(복사,원본,복사할문자갯수): 갯수만큼 문자열복사
    temp[i] = '\0';
    strcat(temp,t); //strcat: 문자열뒹에 다른문자 붙이기
    strcat(temp,(s+i));
    strcpy(s,temp); //strcpy(복사,원본): 문자열복사
  }
}

int main() {
  
  char a[10] = {"abc"};
  char b[10] = {"house"};
  
  strnins(a,b,1);
  
  printf("%s\n", a);

  return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: