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. Mybatis配置文件无故报错、无自动完成提示的解决方法,及自动生成主要配置项

    1.引子 Mybatis配置文件显示红叉有错误,而实际检查又没有错误,这是因为开发环境不能识别这种类型的xml文件.要解决这个问题,就要让IDE开发环境能够“认识”这个文件类型,我们要让IDE环境将这 ...

  2. Dynamics CRM - 为 sub-grid 添加 OnChange 事件

    目的: 有的时候我们需要对 sub-grid 内容进行监控,比如在 sub-grid 上添加.删除了一条记录后,要对 Form 上的某个字段值进行更新. 解决方案: 对 sub-grid 添加一个 O ...

  3. redis备忘录

    Redis 是一个基于内存的高性能key-value数据库.Redis本质上是一个Key-Value类型的内存数据库,很像memcached,整个数据库统统加载在内存当中进行操作,定期通过异步操作把数 ...

  4. Ubuntu下安装Docker,及Docker的一些常用命令操作

    1.什么是 Docker         Docker 是一个开源项目,Docker 项目的目标是实现轻量级的操作系统虚拟化解决方案.         Docker 的基础是 Linux 容器(LXC ...

  5. 使用tensorflow的retrain.py训练图片分类器

    参考 https://hackernoon.com/creating-insanely-fast-image-classifiers-with-mobilenet-in-tensorflow-f030 ...

  6. 解决LoadRunner服务器返回乱码

  7. 1.windows-oracle实战第一课

    一.oracle是目前最流行的数据库之一,功能强大.性能卓越.学习要有信心.oracle也做软件,不仅仅是数据库.比如ERP(企业资源计划,用友.金蝶) 二.目前的数据库   相对而言:       ...

  8. [Algo] 292. String Abbreviation Matching

    Word “book” can be abbreviated to 4, b3, b2k, etc. Given a string and an abbreviation, return if the ...

  9. php先响应后处理

    php响应异步请求或者返回时效要求高的接口中,可以先响应输出,再执行逻辑处理保存数据等任务 ob_end_clean(); ob_start(); echo '{"data":&q ...

  10. SLAM——视觉里程计(一)feature

    从现在开始下面两篇文章来介绍SLAM中的视觉里程计(Visual Odometry).这个是我们正式进入SLAM工程的第一步,而之前介绍的更多的是一些基础理论.视觉里程计完成的事情是视觉里程计VO的目 ...