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. thanx very much...
View Tutorial          By: Rajesh at 2015-10-09 08:57:36

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

3. Fantastic yaar .realy very good n simple example..
View Tutorial          By: Satya at 2012-10-11 09:33:17

4. Can u plz send me woking application (Send sms) J
View Tutorial          By: Ritanshu Goel at 2012-09-22 05:52:49

5. it doesn't count for the values like 001 or 02 et
View Tutorial          By: angesh at 2012-02-10 16:15:02

6. please i need the link to download the file requir
View Tutorial          By: kamahsteve at 2012-11-17 10:20:22

7. I've been satisfied with your tutorial site. Since
View Tutorial          By: Mark Harold F. Manguino at 2008-08-06 05:00:54

8. i want to learn the java from basics onwards.
View Tutorial          By: vinay at 2010-03-08 22:54:15

9. <%!
DateFormat date = DateFormat.getDat

View Tutorial          By: saifuctg at 2011-12-30 22:24:54

10. i am confused with importing a package.is it equiv
View Tutorial          By: amit at 2011-07-04 04:16:04