Difference between strdup and strcpy in c language?



Difference between strdup and strcpy in c language?..

Answer / 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

More Engineering AllOther Interview Questions

how to handle errors in fastload?

0 Answers   Wipro,


i have an interview in Qatar Petroleum. So please provide the all details abt safety management

0 Answers   Qatar Petroleums,


how to send request to the direct server rather than proxy server

0 Answers  


what is major differnet between hub and switch and also defferent between router and switch

0 Answers   ACS,


what is networking

3 Answers   TCS,






which topics are come from quizs

0 Answers  


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

0 Answers  


Is there aptitute question will be asked in NIC exam ??? If yes how many questions will be asked??

0 Answers  


What is saturation point?

1 Answers  


Index of an Array containing 'n' aliment varies from________to_______

0 Answers  


hi this is padhu i just want to know about remote sensing scientist in ISRO, will there a written test or not if there are any model test papers plz post it.

1 Answers  


what is the maximum load for MDB, SMDB & DB

1 Answers   Target,


Categories
  • Civil Engineering Interview Questions Civil Engineering (5085)
  • Mechanical Engineering Interview Questions Mechanical Engineering (4451)
  • Electrical Engineering Interview Questions Electrical Engineering (16632)
  • Electronics Communications Interview Questions Electronics Communications (3918)
  • Chemical Engineering Interview Questions Chemical Engineering (1095)
  • Aeronautical Engineering Interview Questions Aeronautical Engineering (239)
  • Bio Engineering Interview Questions Bio Engineering (96)
  • Metallurgy Interview Questions Metallurgy (361)
  • Industrial Engineering Interview Questions Industrial Engineering (259)
  • Instrumentation Interview Questions Instrumentation (3014)
  • Automobile Engineering Interview Questions Automobile Engineering (332)
  • Mechatronics Engineering Interview Questions Mechatronics Engineering (97)
  • Marine Engineering Interview Questions Marine Engineering (124)
  • Power Plant Engineering Interview Questions Power Plant Engineering (172)
  • Textile Engineering Interview Questions Textile Engineering (575)
  • Production Engineering Interview Questions Production Engineering (25)
  • Satellite Systems Engineering Interview Questions Satellite Systems Engineering (106)
  • Engineering AllOther Interview Questions Engineering AllOther (1379)