Difference between strcpy() and memcpy() function

Explain the difference between strcpy() and memcpy() function.

strcpy() copies a string until it comes across the termination character ‘\0’. With memcopy(), the programmer needs to specify the size of data to be copied. strncpy() is similar to memcopy() in which the programmer specifies n bytes that need to be copied.

The following are the differences between strcpy() and memcpy():

- memcpy() copies specific number of bytes from source to destinatio in RAM, where as strcpy() copies a constant / string into another string.

- memcpy() works on fixed length of arbitrary data, where as strcpy() works on null-terminated strings and it has no length limitations.

- memcpy() is used to copy the exact amount of data, whereas strcpy() is used of copy variable-length null terminated strings.
Difference between exit() and _exit() function
exit() and _exit() : exit() does cleanup work like closing file descriptor, file stream and so on, while _exit() does not....
Compare array with pointer
The first declaration allocates memory for a pointer; the second allocates memory for 20 characters.....
What is NULL pointer?
A null pointer does not point to any object. NULL and 0 are interchangeable in pointer contexts.Usage of NULL should be considered a gentle reminder that a pointer....
Post your comment