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. hi,
How to create certificate from https://

View Tutorial          By: CN Balu Ramesh at 2011-07-19 08:38:31

2. providing explanation about the topics is very use
View Tutorial          By: vikram naidu at 2010-06-09 23:40:41

3. when i copy paste your program or source code

View Tutorial          By: Zordan at 2011-03-17 04:28:08

4. great work..keep it up.
View Tutorial          By: faizaan at 2011-04-29 12:23:39

5. Your code will not execute using above main method
View Tutorial          By: Gajanan Patil at 2012-05-09 04:42:29

6. Hi it is working fine .but when my server we imple
View Tutorial          By: mohan at 2014-11-28 10:57:22

7. Hi, You can use a javascript array. Which means wh
View Tutorial          By: Mashoud at 2008-05-04 02:54:38

8. Nice Tips thank you
View Tutorial          By: Giritharan at 2013-04-11 09:24:37

9. Thanks!! Its very helpful.
View Tutorial          By: Tawfiiq at 2012-07-06 05:29:50

10. DOWNLOAD IT
View Tutorial          By: KUSUM at 2010-02-02 23:48:50