void *memset(void *str, int c, size_t n)

Syntax

  void *memset(void *str, int c, size_t n)

Description:

    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.

Parameters:

  • str -- This is a pointer to the block of memory to fill.
  • c -- This is the value to be set. The value is passed as an int, but the function fills the block of memory using the unsigned char conversion of this value.
  • n -- This is the number of bytes to be set to the value.

Return Value:

  This function returns a pointer to the memory area str.

void *memchr(const void *str, int c, size_t n)

Description

    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.

Parameters

  • 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。

int memcmp(const void *str1, const void *str2, size_t n)

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.

void *memmove(void *str1, const void *str2, size_t n)

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.

C语言标准库 常用函数说明的更多相关文章

  1. Python math库常用函数

    math库常用函数及举例: 注意:使用math库前,用import导入该库>>> import math 取大于等于x的最小的整数值,如果x是一个整数,则返回x>>> ...

  2. Matplotlib库常用函数大全

    Python之Matplotlib库常用函数大全(含注释) plt.savefig(‘test’, dpi = 600) :将绘制的图画保存成png格式,命名为 test plt.ylabel(‘Gr ...

  3. Python之Numpy库常用函数大全(含注释)

    前言:最近学习Python,才发现原来python里的各种库才是大头! 于是乎找了学习资料对Numpy库常用的函数进行总结,并带了注释.在这里分享给大家,对于库的学习,还是用到时候再查,没必要死记硬背 ...

  4. Python之Numpy库常用函数大全(含注释)(转)

    为收藏学习,特转载:https://blog.csdn.net/u011995719/article/details/71080987 前言:最近学习Python,才发现原来python里的各种库才是 ...

  5. SymPy库常用函数

    简介 SymPy是一个符号计算的Python库.它的目标是成为一个全功能的计算机代数系统,同时保持代码简 洁.易于理解和扩展.它完全由Python写成,不依赖于外部库.SymPy支持符号计算.高精度计 ...

  6. 【转】 C++库常用函数一览

    本文中提到的函数库有:<string> <cctype> <algorithm> <cmath> <cstdlib> <iomanip ...

  7. Python time库常用函数

    time模块中时间表现的格式主要有三种: timestamp 时间戳,时间戳表示的是从1970年1月1日00:00:00开始按秒计算的偏移量 struct_time 时间元组,共有九个元素组. for ...

  8. C标准库常用函数概要

    stdio.h printf()/fprintf() printf的返回值是打印的字符数, 发生错误则返回负数 scanf()/fscanf() scanf的返回值是成功赋值的变量个数, 失败则返回E ...

  9. Pandas库常用函数和操作

    1. DataFrame 处理缺失值  dropna() df2.dropna(axis=0, how='any', subset=[u'ToC'], inplace=True) 把在ToC列有缺失值 ...

随机推荐

  1. 1.where子句的优化

    不需要在牺牲可读性的情况下重写sql,因为mysql会自动进行类似的优化. 1.去掉无用的括号 ((a AND b) AND c OR (((a AND b) AND (c AND d)))) -&g ...

  2. 吴裕雄--天生自然ShellX学习笔记:Shell 输入/输出重定向

    大多数 UNIX 系统命令从你的终端接受输入并将所产生的输出发送回​​到您的终端.一个命令通常从一个叫标准输入的地方读取输入,默认情况下,这恰好是你的终端.同样,一个命令通常将其输出写入到标准输出,默 ...

  3. c指针(2)

    #include<stdio.h> #include<malloc.h> #include<stdlib.h> typedef struct LNode { cha ...

  4. vim编辑模式下黑色背景,下来过程中出现白条的问题

    问题描述,原本是黑色背景,但是下拉过程中没有文字的地方会变成白色,非常影响美观,搞了好久现在中与改好了.问题如图: 打开-/.vimrc 文件,在如图所示位置加上62-64行代码即可.root用户的添 ...

  5. C/C++中开平方函数sqrt()的用法

    开平方使用sqrt()函数 使用方法: 包含于math.h头文件 sqrt(float * number),返回number的开平方数,返回值为浮点型 sqrt使用时大多需要要强制类型转化,因为sqr ...

  6. C++ lock_guard 互斥锁

    概述根据对象的析构函数自动调用的原理,c++11推出了std::lock_guard自动释放锁,其原理是:声明一个局部的lock_guard对象,在其构造函数中进行加锁,在其析构函数中进行解锁.最终的 ...

  7. SQL Server Driver for PHP之sqlsrv相关函数

    SQL Server Driver for PHP 包含以下函数: 函数 说明 sqlsrv_begin_transaction 开始事务. sqlsrv_cancel 取消语句:并放弃相应语句的所有 ...

  8. [HDU多校]Ridiculous Netizens

    [HDU多校]Ridiculous Netizens 点分治 分成两个部分:对某一点P,连通块经过P或不经过P. 经过P采用树形依赖背包 不经过P的部分递归计算 树型依赖背包 v点必须由其父亲u点转移 ...

  9. 《VSTO开发中级教程》刘永富 著 清华大学出版社 在线购买

    现在可以和作者 刘永富 通过“二手书直卖”这个APP直接买书. 二手书直卖 的下载方法: 方法一:加QQ群61840693,群共享中搜索“二手书直卖”,下载后打开即可. 方法二:从本帖下载:二手书直卖 ...

  10. Linux_拷贝,剪切,删除和创建文件

    cp 你要拷贝的文件 + 目录/带路径的文件名(在拷贝的同时,让这个文件重新命名) cp /tep/dir01  ~  代表将dir01拷贝到当前用户的家目录中 cp /tep/dir02  ~/di ...