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
To 15:
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.


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. nice examlpe but u can make it more easy so that t
View Tutorial          By: lovely at 2009-02-25 07:08:18

2. can anyone tell me which type of device i need to
View Tutorial          By: dhanunjay at 2009-04-01 00:31:17

3. Nice Article....
View Tutorial          By: Vipin Joshi at 2008-04-13 15:35:42

4. Check a cool file reader
View Tutorial          By: John at 2010-09-13 01:38:21

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