MEMSET function usage

xiaoxiao2021-04-02  209

Prototype: Extern void * MEMSET (Void * Buffer, Int C, INT COUNT);

Usage: #include

Function: Set the before the Buffer's before the memory area of ​​the memory area is set as a character C.

Description: Returns the pointer to the buffer.

Example:

// Memset.c

#include

#include

Main ()

{

Char * s = "Golden Global View";

CLRSCR ();

MEMSET (S, 'G', 6);

Printf ("% s", s);

GetChar ();

Return 0;

}

Note: Memset is assigned to each byte, if this declaration is

INT A [256], but int 4 bytes (32-bit)

For example, MEMSET (A, 1, SIZEOF (A));

Then, each element in A is assigned to become a 2-grade number, 00000001000000010000000100000001, Number

Convert to 10 credits 16843009

Therefore, it is generally assigned 0 or -1 to the number of MEMSET, and other values ​​are used to be implemented.

转载请注明原文地址:https://www.9cbs.com/read-131396.html

New Post(0)