Implement strcpy functions, memcpy functions

Source: Internet
Author: User

650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M01/75/AE/wKiom1ZAV2nA8IwUAAH-fwsarWo799.jpg "style=" float: none; "title=" qq20151109160332.jpg "alt=" Wkiom1zav2na8iwuaah-fwsarwo799.jpg "/>

650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M00/75/AC/wKioL1ZAV6_i6kOkAAEQe7RQOzQ297.jpg "style=" float: none; "title=" qq20151109160349.jpg "alt=" Wkiol1zav6_i6kokaaeqe7rqozq297.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/75/AE/wKiom1ZAV2qRfZPNAAGEUZZD4MI126.jpg "style=" float: none; "title=" qq20151109161958.jpg "alt=" Wkiom1zav2qrfzpnaageuzzd4mi126.jpg "/>

It is important to note that in lines 44th and 45, strlen is a function, and sizeof is an operator.

Strlen () starts a scan from somewhere in the memory, knowing that the first string terminator is ' s ', and then returns the counter value (not including ' s ').

sizeof is an operator, simply, that returns the number of bytes of memory that an object or type occupies.


The difference between strcpy and memcpy:

1, copied content, strcpy can only copy strings, and memcpy can copy arbitrary content, for example, character array, type, struct, class, etc.

2, the method of copying is different, strcpy does not need to specify the length, it encounters the string Terminator ' \ ' will end. memcpy determines the length of the copy according to its 3rd parameter.

3, the use of different, usually in the copy string is used strcpy, and the need to copy other types of data is generally used memcpy.



Implement strcpy functions, memcpy functions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.