ProAnswers.org

Difference between strdup and strcpy?

Both copy a string. strcpy wants a buffer to copy into. strdup allocates a buffer using malloc().

Unlike strcpy(), strdup() is not specified by ANSI .