strcpy is meant to copy only null-terminated strings. It is probably : implemented to copy every byte until it encounters a #0. : memcpy can copy any memory location. It is not bound by a : null-terminated string. Since memcpy cannot determine the size of : the data to be copied, it needs the programmer to provide that : information.
That is correct. Note that there is also a function called strncpy() which copies n bytes. It is almost identical to memcpy(), with the difference that it adds null termination at the end of the target string.
strncpy() & memcpy() function in C
Profile Answers by Muthupandi_s Questions by Muthupandi_s
Questions by Muthupandi_s