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



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. is there any port filter/block api for java?
View Tutorial          By: edwin at 2010-08-12 03:16:44

2. This the very good introduction to the J2ME for th
View Tutorial          By: chetan jain at 2010-04-01 06:39:32

3. Its a good intro about J2ME..Thanks
View Tutorial          By: Deiveegaraja Andaver at 2012-02-10 06:53:29

4. After a great struggle I am able to successfully c
View Tutorial          By: raghu at 2012-01-04 15:10:07

5. What about GraphicsDemo (class...?) mentioned in l
View Tutorial          By: Achi at 2008-01-08 04:21:57

6. Its very useful to me
View Tutorial          By: suba at 2011-07-04 11:21:19

7. download jdk
View Tutorial          By: alireza esfandyarinezhad at 2011-03-07 11:52:55

8. Hi.
How we can create list with menuitem in

View Tutorial          By: omid at 2008-09-08 02:09:50

9. The Compleate Reference
JAVA Seventh Editi

View Tutorial          By: joshap at 2014-10-25 12:05:41

10. I have a small query: Is it interface allow method
View Tutorial          By: vijay at 2012-04-20 10:34:30