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

How to defaultly populate charges in Clear transactions window for Cash Management?

1406


what is node class?

1753


what is difference between class and object in c++

1584


Hi Friends, I am doing engg in comp sc in the final year from the evening college, I don't have experience in technical field. I am working in nontechnical field. I have big question that will IT companies considered me as fresher or they looks experience from me ? if you reply to my query, i am really grateful to you

1467


sir i m reject two time in u.s in spring intake now im taking a date of 1july-2010 in fall intake &im competed my bachlor degree(chem) in jun-2009 so what answer i give to visa officer ask me a what r u doing last 1-year bcoz i have no work expirience

1352






1. Describe a time when you anticipated potential problems and developed Preventive measures.

1681


What is ball bearing concept & its design.

1430


i have passed my gRaduation in BCA and now im looking for post graduation from Germany, i haver passed my ielts wth 6 band, nw plz tell me some question that wll ambessay ask

1386


What is Campus selection process of patni at Adcet,Ashta at 24th dec 2010.Also give apti syllabus.

2023


what is difference between shell commands and shell scripting commands or both r same?

1617


I think it is 65% in 10th, 12th n BE with a 5% relaxation in any one. For west bengal bord..what will be simple average for HS...is the additional marks would be adde with 100+200=1200.and the the average will be done. OR it will be treated 65% if somebody gets 650 in HS.? Please reply for this question......... And what is the marks criteria for infosys for experienced employee.

1652


What is the pattern for HAL Online-exam?

1672


hi ,,,,I m going to attend corporate bank exam of specialist IT officer, I don't Know What type of question arise in interview..some suggest me my email id is surinder.singh.btech@gmail.com

1568


hi , anyone plz end nic model papers to my id

1509


i am satish i want to preapare for group-1 exams so please help me?

1544