64 491
Assignments Done
99,1%
Successfully Done
In September 2018

Answer to Question #57892 in C for Mandy

Question #57892
int mallocPlusStrcpy(const char* src, char* dst)

This function should take in a char*, which may be null or may or may not otherwise be populated with data, allocate a new char* dst of appropriate length, correctly copy the string, and return the number of bytes copied.

Something is wrong with the function definition you are given above. What is it? Provide a corrected function definition.
Expert's answer
Answer: mallocPlusStrcpy(const char* src)

because memory must be both allocated and free in main or in mallocPlusStrcpy

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions