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. BIG Thanks for such wonderful tutorial :) :) :)
View Tutorial          By: dhruva at 2013-07-10 08:56:27

2. Excellent tutorial thank you very much.

View Tutorial          By: Edd at 2012-01-15 10:49:00

3. can't build the 2nd code in netbeans,here is the
View Tutorial          By: arshavin at 2010-04-14 23:19:33

4. Except for when you're programming low level hardw
View Tutorial          By: Jonathan H at 2012-05-10 08:46:48

5. The code to show recursion is ok, but the declara
View Tutorial          By: Gaurav at 2010-08-08 01:08:27

6. Hi,
The code runs fine on my emulator even

View Tutorial          By: Ramin at 2011-07-07 07:23:45

7. thank u.....
View Tutorial          By: DiptaRanjan at 2013-02-02 14:56:45

8. its not sufficient add more details..
View Tutorial          By: vikas at 2013-04-12 12:06:01

9. Can u please tell me how to compile and execute a
View Tutorial          By: RJ at 2010-04-20 01:30:10

10. Hi thanks for the example for overriding toString(
View Tutorial          By: Reshma at 2011-05-11 10:46:08