Syntaxapp
void *memset(void *str, int c, size_t n)less
Description:this
The C library function void *memset(void *str, int c, size_t n) copies the character c (an unsigned char) to the first n characters of the string pointed to, by the argument str.spa
Parameters:指針
Return Value:orm
This function returns a pointer to the memory area str.htm
Descriptionip
The C library function void *memchr(const void *str, int c, size_t n) searches for the first occurrence of the character c (an unsigned char) in the first n bytes of the string pointed to, by the argument str.內存
Parametersget
str -- This is the pointer to the block of memory where the search is performed.
c -- This is the value to be passed as an int, but the function performs a byte per byte search using the unsigned char conversion of this value.
n -- This is the number of bytes to be analyzed.
Return Value
This function returns a pointer to the matching byte or NULL if the character does not occur in the given memory area.
從buf所指內存區域的前count個字節查找字符ch。當第一次遇到字符ch時中止查找。若是成功,返回指向字符ch的指針;不然返回NULL。
Description
The C library function int memcmp(const void *str1, const void *str2, size_t n)) compares the first n bytes of memory area str1 and memory area str2.
Parameters
str1 -- This is the pointer to a block of memory.
str2 -- This is the pointer to a block of memory.
n -- This is the number of bytes to be compared.
Return Value
if Return value < 0 then it indicates str1 is less than str2.
if Return value > 0 then it indicates str2 is less than str1.
if Return value = 0 then it indicates str1 is equal to str2.
Description
The C library function void *memmove(void *str1, const void *str2, size_t n) copies n characters from str2 to str1, but for overlapping memory blocks, memmove() is a safer approach than memcpy().
Declaration
Following is the declaration for memmove() function.
Parameters
str1 -- This is a pointer to the destination array where the content is to be copied, type-casted to a pointer of type void*.
str2 -- This is a pointer to the source of data to be copied, type-casted to a pointer of type void*.
n -- This is the number of bytes to be copied.
Return Value
This function returns a pointer to the destination, which is str1.