If you want to copy 25 characters from source string using strncpy( ) function, only 20 characters from source string will be copied into destination string and remaining 5 characters won’t be copied and will be truncated.

Example program for strncpy( ) function in C:

In this program, only 5 characters from source string “fresh2refresh” is copied into target string using strncpy( ) function.