I read that strcpy is for copying a string, and strdup returns a pointer to a new string to duplicate the string.
strcpy
strdup
Could you please explain
char *strdup(char *pszSrch);
char *strdup(char *pszSrch)
strdup will allocate storage the size of the original string. If storage allocation is successful, the original string is copied to the duplicate string.
strdupd return NULL on failure. If memory is not allocated, copy fails strdup return NULL.
NULL