#include <stdio.h>
#include <stdint.h>
#include <string.h>

int main() {
    char str[10] = "adarsh";
    char new[5] = "Hi";

    char sub[10] = {0};

    memcpy(sub,str,3);
    printf("%s\n",sub);3
    
    memmove(sub+3,new,2);
    printf("%s\n",sub);

    memmove(sub+5,str+3,3);//no buffer char like sub+6
    printf("%s\n",sub);

    // Add a blank gap at the 5th position
    memmove(sub + 4, sub + 3, strlen(sub + 3) + 1);  // Shift elements to the right
    sub[4] = ' ';  // Add a blank gap at the 5th position

    printf("%s\n", sub);
}

Embed on website

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