Comment on Tutorial - Using memset(), memcpy(), and memmove() in C By Emiley J
Comment Added by : Anderson Goulart
Comment Added at : 2010-08-24 19:15:14
Comment on Tutorial : Using memset(), memcpy(), and memmove() in C By Emiley J
Sometimes it is useful to return the same address passed in the parameters and the developer should think what parameter he should return.
The common case occur when you want to chain the result of a function inside another function like: strcat(strcpy(buf, "hi "), "friend");
The strcpy function returns the same address of buf, as memcpy does. If strcpy did not return buf address, you should store this value elsewhere before use strcat.
Think of this another situation:
return memcpy(malloc(sizeof(int)), &number, 4)
You use malloc directly inside the memcpy function and has no source pointer stored in a variable. So, in this case, you would need the return value of memcpy.
- Data Science
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews
Subscribe to Tutorials
1. nice examlpe but u can make it more easy so that t
View Tutorial By: lovely at 2009-02-25 07:08:18
5. Please, send me a working JSP version ,i got error
View Tutorial By: Pang at 2008-01-11 00:01:52
6. Sir. Please give an example which is small and und
View Tutorial By: mogesie gedamu at 2011-12-19 12:55:33
7. Plz can someone help me, I copied the code above a
View Tutorial By: Dse90 at 2010-02-10 04:28:34
8. @Brian rename the file name to match the class nam
View Tutorial By: QuangQUang at 2015-09-27 14:44:37
9. Hagti hain.. the complete program has been copy pa
View Tutorial By: Macho Man at 2012-06-21 07:58:03
10. It's very easy to learn try / catch functionality.
View Tutorial By: Ponraj at 2013-01-31 04:21:06