• Source
    1. #include <stdio.h>
    2. #include <string.h>
    3.  
    4. int main()
    5. {
    6. char src[40]; // char array of size 40
    7. char dest[100]; // char array of size 100
    8.  
    9. memset(dest, '\0', sizeof(dest)); // fill the dest array with nul (\0), specifying the end of the string
    10. strcpy(src, "This string is 34 characters long."); // copy a string literal into src
    11. strcpy(dest, src); // now copy src into dest
    12.  
    13. printf("src string : %s\n", src); // display src
    14. printf("dest string : %s\n", dest); // display dest
    15. printf("Length of dest : %d", strlen(dest)); // use strlen() to find the length of dest
    16.  
    17. return(0);
    18. }