Difference between strdup and strcpy in c language?

Answer Posted / kalai

strcpy - copy a string to a location YOU created (you create the location, make sure that the source string will have enough room there and afterwards use strcpy to copy)
strdup - copy a string to a location that will be created by the function. The function will allocate space, make sure that your string will fit there and copy the string. Will return a pointer to the created area.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Please help to write testcase for ECG machine

1633


I want old SBI question papers plzzzzzzzzz

1693


what type of questions pannel ask to the intervier? plz i want questions about computer engineering? System security subject.

1810


what is your experience in developing technical specifications?

1785


how to conrtruct gear make him rotate on its axis

1651


can oracle driver be directly connected with odbc driver??

1472


Discuss the various process operations, clearly stating what is involved in each process operation.

1262


I want to make my career in networking so how to going there? right now i have done a+ n+ ccna course from cms com institute but i m not certified with globle certification os what is my frist step ?, my finincial prob also with me plz sorry isubmit it

1701


What is the difference between command line argument and input taking from the user?

1599


Relative Humidity (RH) is mostly used word in Datacenters, What are the defendents of RH

1509


explain overloaded constrator © constractor

1864


What are the main differences between the engines in jet fighters and the engines in jet airliners; which type of engine is the more efficient, and (qualitatively) why?

915


when there is a parametrized constructor, and an object is created with no arguments. will the default constructor be called?

1918


Please send me Sample papers OF National Informatics Centre (NIC) Vacency

1866


What is W-model in Software Engineering?

4056