| 1. |
List Out Differences Between Strdup() And Strcpy()? |
|
Answer» The FUNCTION strcpy() will not allocate the MEMORY space to COPY. A POINTER to the STRING to copy and a pointer to place to copy it to should be given. The function strdup() will occupy / grab itself the memory space for copying the string to. This memory space needs to be freed up later when it is of no use anymore. The function strcpy() will not allocate the memory space to copy. A pointer to the string to copy and a pointer to place to copy it to should be given. The function strdup() will occupy / grab itself the memory space for copying the string to. This memory space needs to be freed up later when it is of no use anymore. |
|