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
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
MultiLevel Inheritance sample in Java
Archived Comments
1. Assalamu alaikum saaliya sir,
Could
View Tutorial By: Jaffer sulaiman at 2014-08-23 06:01:20
2. hi...i want a code to send sms from GSM to PC.
View Tutorial By: siri at 2011-12-19 07:39:02
3. tnx man that was short and well explained...
View Tutorial By: jsf noob at 2012-02-02 13:24:12
4. Dude, that LOOP wont work i cant even understand w
View Tutorial By: Rohan at 2012-02-16 17:04:06
5. Thank you very much you resolved my issue.
View Tutorial By: ketan at 2012-02-01 11:16:47
6. no output is shown
View Tutorial By: shubham bansal at 2015-02-21 15:36:31
7. Hi fiends,
your given approch is correct .
View Tutorial By: Amit Kumar Singh at 2011-10-10 04:44:58
8. Hi, If any body was able to send the message suces
View Tutorial By: kavin at 2011-03-14 06:24:18
9. vinod kumar for j2me app development we need one I
View Tutorial By: saurabh dixit at 2013-04-18 09:59:23
10. In line No. 23, change stmd to stmt.
Re
View Tutorial By: Rishi Raj at 2011-07-08 13:50:11