Login
Remember
Register
Ask a Question
Difference between strdup and strcpy in C Language?
0
votes
asked
Mar 10, 2020
in
C Plus Plus
by
rahuljain1
Difference between strdup and strcpy in C Language?
#c-language-strdup
#c-language-strcpy
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Mar 10, 2020
by
SakshiSharma
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 .
...