Memset and memset Functions

Source: Internet
Author: User

Memset and memset Functions
 

NAME

Memset-- Fill a byte string with a byte value

LIBRARY

Standard C Library (libc,-lc)

SYNOPSIS

# Include <String. h>

Void *Memset(Void * B, int c, size_t len)

{

Assert (B! = NULL );

Char * retAddr = (Char*) B;

While (len --> 0)

{

* (RetAddr ++) = (Char) C;

}

Return retAddr;

}

DESCRIPTION

TheMemset() Function writes len bytes of value c (converted to an unsigned char) to the string B.

RETURN VALUES

TheMemset() Function returns its first argument.

NOTES

  MemsetIs to fill in byte, soVoid * BGenerallyChar *Type.Void * BCan be filled with only two values{0,-1}. Because the computerBinary ComplementNumber,The binary complement of 0 is all 0,-The binary complement of 1 is full 1..

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.