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. Guys can you send me complete program for recievei
View Tutorial          By: KEVIN at 2011-06-10 21:52:04

2. It was really good.helped me a lot to get started.
View Tutorial          By: rohit at 2010-08-21 04:57:32

3. Can u tell it can also use for connecting to oracl
View Tutorial          By: Ankur Jain at 2010-08-06 05:31:08

4. hi all !

This is the error im getti

View Tutorial          By: Ajit at 2010-02-17 23:09:47

5. Very nice
View Tutorial          By: sharath at 2012-07-17 11:31:20

6. i want to know about java related topic in simple
View Tutorial          By: saurav at 2010-04-29 04:39:55

7. hai.....people ..............


View Tutorial          By: spartan at 2009-08-08 08:42:35

8. its work well , thanks for code , but if any body
View Tutorial          By: mary at 2007-12-16 07:10:58

9. great explanations.. some important words are miss
View Tutorial          By: Joshua Paul at 2015-04-14 03:43:44

10. I agree with BHAGYALAXMI. I faced the same problem
View Tutorial          By: Alok at 2010-01-10 12:03:37