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



Ask a Question

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 can u send me the complete working code for sen
View Tutorial          By: gautami at 2007-12-04 01:13:45

2. thank you so much i satisfied for the tutorial in
View Tutorial          By: flick at 2010-09-24 21:10:59

3. Hi, Razvan

I change over to using y

View Tutorial          By: James at 2010-12-22 00:44:50

4. I want to change software of micromax x455 mobile
View Tutorial          By: Sachin at 2012-12-29 09:39:58

5. Very nice demo. thanks! :)
View Tutorial          By: Nikhil Gala at 2012-01-13 10:03:57

6. I use this all the time. You can use this exactly
View Tutorial          By: Chetan at 2015-09-08 08:56:06

7. Thanks it helped to understand but error occurred
View Tutorial          By: Maya at 2010-11-17 22:08:10

8. as we write:
ob1.t.join();
Does t

View Tutorial          By: abc123 at 2011-04-03 13:33:33

9. Very Very nice code
View Tutorial          By: Kits at 2009-05-26 07:54:46

10. very helpful.
View Tutorial          By: arjun at 2011-07-19 03:19:44