What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
Question: What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?Answer: The strcpy() function is designed to work exclusively with strings. It copies each byte of the source string to the destination string and stops when the terminating null character () has been moved. On the other hand, the memcpy () function is designed to work with any type of data. Because not all data ends with a null character, you must provide the memcpy () function with the number of bytes you want to copy from the source to the destination.
keywords:
difference between strcpy() and memcpy with example
how can i remove the trailing spaces from a string?
difference between memcpy and strncpy
how can i remove the trailing spaces from a string in c
difference between memcpy and memmove
c copy string using memcpy
No comments:
Post a Comment