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. I have been trying to learn ASP.net for a week and
View Tutorial          By: eric at 2010-08-06 15:43:49

2. i installed the code in ecllipse,but i have one do
View Tutorial          By: vamsi at 2015-05-19 10:56:25

3. thanks. it helped a lot!
View Tutorial          By: lateforbus at 2013-04-25 03:35:24

4. 'Numbers' is the name of his table, you need to su
View Tutorial          By: Amir at 2010-09-15 10:59:20

5. I tried ....so this is best solution for understa
View Tutorial          By: rehnuma at 2015-03-30 12:29:38

6. hi in the above example u created a example for do
View Tutorial          By: akki at 2013-02-22 06:19:14

7. Excellent. I got stuck in a huge project and was f
View Tutorial          By: Rahul Tiwari at 2010-12-08 22:40:29

8. Where to put the smsc number. I am using vodafone
View Tutorial          By: gopi at 2009-06-11 22:07:49

9. Thanks for to solve my doubt.
View Tutorial          By: ANJILAIAH at 2010-10-08 09:46:11

10. thanks for this pertinent remark.
View Tutorial          By: mohammed at 2009-02-21 05:43:11