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

int main() {
    char str1[20]="1234567890";
    char str2[20];
    char str3[5];

    strcpy(str2, str1);
    puts(str2);

    strncpy(str3, str1, sizeof(str3));
    puts(str3);

    strncpy(str3, str1, sizeof(str3)-1);
    str3[sizeof(str3)-1]=0;
    puts(str3);
    
    return 0;
}

Embed on website

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