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
View Tutorial          By: raj at 2010-02-12 02:48:09

2. Hi All could you pls. send the execution of the ab
View Tutorial          By: subbu at 2008-01-28 03:14:27

3. how to read csv file using Java
View Tutorial          By: Shireesha at 2013-12-26 07:34:22

4. hi i want to run a c program in java program but i
View Tutorial          By: jyothi at 2014-11-27 06:40:27

5. hey what If I'm connecting to a server(XMPP in my
View Tutorial          By: garima at 2015-08-10 13:23:40

6. Code indentation would help!...
View Tutorial          By: James at 2011-06-30 04:54:51

7. nice article... got th topic clearly
View Tutorial          By: praba at 2011-05-09 23:29:26

8. When run this code then I am getting a blank page.
View Tutorial          By: Paritosh Chandra Dey at 2013-08-14 08:55:42

9. thanks a lot fo the help offered.
View Tutorial          By: Douglas [email protected] at 2012-10-31 05:37:04

10. Thanks a lot .. Great work!!
View Tutorial          By: MonamAlwerfally at 2013-03-26 14:41:29