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. This code is only for send sms? can it also alert
View Tutorial          By: abdul kadir at 2009-10-23 05:37:46

2. Thanks so much useful to me.
View Tutorial          By: Bhuvan at 2012-05-31 14:57:57

3. simply nice.. Thank you.
View Tutorial          By: Anil at 2011-11-30 06:36:23

4. Hi Rajesh, you have found the right site. look at
View Tutorial          By: mohan at 2008-07-27 08:55:17

5. Thank you... Helpful :)
View Tutorial          By: Soopy at 2015-03-31 06:24:57

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

7. Thanks i had problem with this util module.
View Tutorial          By: james thompson at 2013-09-08 22:25:50

8. Helps very much. Thank you.
View Tutorial          By: Uwe at 2010-08-17 12:35:44

9. I am getting a blank page. Closed the table tag an
View Tutorial          By: Harshal at 2013-02-19 14:56:35

10. // Using the comma.
class Comma {
pu

View Tutorial          By: jatin kapoor at 2011-01-22 03:43:10