Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
Difference between strdup and strcpy in C Language?
Home
C Plus Plus
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 .
Related questions
0
votes
Q: State the difference between delete and delete[] in C Language
asked
Jun 11, 2020
in
C Plus Plus
by
Robindeniel
#delete-vs-delete
0
votes
Q: What is the difference between Strings and Arrays in C Language?
asked
Mar 12, 2020
in
C Plus Plus
by
rahuljain1
#c-language-string-vs-array
0
votes
Q: Difference between arrays and linked list in C Language?
asked
Mar 10, 2020
in
C Plus Plus
by
rahuljain1
#c-language-array
#c-language-linked-list
0
votes
Q: Difference between pass by reference and pass by value in C Language?
asked
Mar 10, 2020
in
C Plus Plus
by
rahuljain1
#c-language-reference-variable
0
votes
Q: Differentiate between for loop and a while loop in C Language? What are it uses in C Language?
asked
Mar 10, 2020
in
C Plus Plus
by
rahuljain1
#c-language-loop
#c-language-while-loop
0
votes
Q: What are the differences between malloc () and calloc () in C Language?
asked
Mar 10, 2020
in
C Plus Plus
by
rahuljain1
#c-language-calloc
c-language-malloc
calloc-vs-malloc
malloc-vs-calloc
0
votes
Q: What are the differences between structures and arrays in C Language?
asked
Mar 10, 2020
in
C Plus Plus
by
rahuljain1
#structure-vs-array
0
votes
Q: What are the differences between structures and union in C Language?
asked
Mar 10, 2020
in
C Plus Plus
by
rahuljain1
#union-vs-structure
0
votes
Q: What is the difference between the local and global variables in C?
asked
Jan 11
in
C Plus Plus
by
GeorgeBell
c-interview-questions-answers
0
votes
Q: What is the difference between ‘g’ and “g” in C?
asked
Jan 6
in
C Plus Plus
by
GeorgeBell
c-interview-questions-answers
...