1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char s[] = "Well begun is half done."; char t[25]; char t1[5]; strcpy(t, s); strncpy(t1, t, 4); printf("%s\n", t); printf("%s\n", t1); return 0; }