Caution !
Make sure that the destination array is large enough to hold the string:Example:char * strcpy(char *dst, char const *src);char message[] = “Original message”strcpy(message, “Different”);/* lost bits */strcpy(message, “A different message”);/* overwrite memory */ Same in:strcat, strncpy /* when s > d */
All string library functions consider ‘\0’ as the end of a string and check for it themselves (don’t use strlen).If no ‘\0’ exists at the end of the string, the output of some functions will be wrong.char dst[100], s[] = “abc”;s[3] = ‘d’; /* overwrites ‘\0’ */strcpy(dst,s); /* oops !!! */ Same in:strncpy, strncat, strncmp /* when s > d */