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
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
Java program to get location meta data from an image
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
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
Archived Comments
1. Your explanation is good but, it will be better i
View Tutorial By: Jabaraj at 2010-03-22 06:02:33
2. Thank you sir.
View Tutorial By: Balan at 2008-09-02 22:16:56
3. sir , i am new in j2me and i want to learn more s
View Tutorial By: vipin Luhach at 2012-01-19 06:43:27
4. It worked for me. Thanks a lot. Hi Sasikumar, I th
View Tutorial By: Ramlak at 2007-03-05 01:53:14
5. Thanks a lot. I've been stuck on this issue for qu
View Tutorial By: Mark at 2008-04-12 22:01:56
6. Please, send me a working JSP version ,i got error
View Tutorial By: Pang at 2008-01-11 00:01:52
7. Good one
View Tutorial By: Ravi at 2007-11-19 03:30:40
8. Mail me Codings in java of different programs
View Tutorial By: vikram at 2008-09-12 06:04:42
9. The textarea value(finalresult) i want save in Tre
View Tutorial By: anbalagan.s at 2007-10-17 05:10:19
10. I have got "time out at step 6". How can
View Tutorial By: MCHON at 2008-10-05 12:36:42