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. what is the usage of 'detail' and 'debug' init par
View Tutorial          By: uday at 2011-07-21 04:53:02

2. I agree with #2 u are missing that line
View Tutorial          By: ויזה לארה"ב at 2011-10-26 10:39:50

3. your code error

because i try to ru

View Tutorial          By: Nasser at 2013-01-09 10:33:34

4. Can you give some examples of do while & pleas
View Tutorial          By: mhilan at 2011-09-01 04:54:13

5. very good explanation... thnx...
View Tutorial          By: gobu at 2009-04-05 23:43:19

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

7. Thank you, very useful example!
View Tutorial          By: Hui Chun Wai at 2013-03-24 15:07:53

8. The example program was very easy to understand un
View Tutorial          By: vijay at 2011-12-27 07:34:35

9. how to run this code....... Please tell somebody m
View Tutorial          By: Honey at 2015-01-24 14:27:38

10. I running this on localhost offline and getting er
View Tutorial          By: nitisha at 2011-05-14 09:18:16