A standard C function that returns the length of a string.


A C standard library function: strncpy is used to copy a maximum of n characters of non-overlapping, fixed-width or null-terminated strings


Quality Example
Source greater

"However if strlen source is greater than n then strncpy will simply copy the first n bytes and will not terminate the string dest with a null byte because there is no space for it"

from question "Do I need to assign \0 to malloc strings in c?"


"This is the case here because strlen hello is greater than 3 your last strncpy argument"

from question "Access violation writing to static global variable?"

Back to Home
Data comes from Stack Exchange with CC-BY-SA-3.0