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. Hi All........
People those who are ge

View Tutorial          By: Abhijit at 2013-05-28 11:24:24

2. Very good.
But is this (Accessor functions

View Tutorial          By: peter at 2011-07-20 13:13:44

3. It's a good eg to learn join and isAlive method.Bu
View Tutorial          By: Nithin at 2012-02-02 08:43:28

4. Looks good, but don't use gets(). gets() is respon
View Tutorial          By: Luke at 2011-11-21 09:03:38

5. I need JSP Code to send SMS to mobile.
View Tutorial          By: nana at 2010-03-12 22:43:22

6. What exactly is d directry for d folder Media?? It
View Tutorial          By: Oraclematrix at 2012-01-15 21:40:54

7. Protip: you could add some inline assembly with th
View Tutorial          By: Robin Degen at 2011-08-16 23:47:04

8. I'd like to Thanks first bcoz your program is real
View Tutorial          By: Pawan at 2012-04-24 19:46:00

9. good and nice
View Tutorial          By: Elayaraja j at 2011-06-18 05:30:07

10. all are easy to understanding codes. . . thanks
View Tutorial          By: kadhir at 2011-06-27 03:33:30