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. PHP的isset()函数 一般用来检测变量是否设置

    PHP的isset()函数 一般用来检测变量是否设置 格式:bool isset ( mixed var [, mixed var [, ...]] ) 功能:检测变量是否设置 返回值: 若变量不存在 ...

  2. JS 日期格式化为 2020-11-01 22:33:44 格式

    项目中经常会用到将JS日期格式化输出为 标准格式(2020-11-01 22:33:44)的问题.写个精简版的,代码如下: function formatDate(d){ d = d || new D ...

  3. 干货|Kubernetes集群部署
Nginx-ingress Controller

    Kubernetes提供了两种内建的云端负载均衡机制用于发布公共应用,一种是工作于传输层的Service资源,它实现的是TCP负载均衡器:另一种是Ingress资源,它实现的是HTTP(S)负载均衡器 ...

  4. java线程——notify通知的泄露

    版权声明:本文为CSDN博主「兰亭风雨」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明.原文链接:https://blog.csdn.net/ns_code/ar ...

  5. HNOI2018/AHOI2018 游戏

    这题放过了暴力其实就没啥意思了 虽然暴力复杂度很玄学,但是思维水平确实没啥 Description link 题意概述:现在有一条长度为 \(n\) 的链,有些边是有限制的 限制为能到某个点,才能经过 ...

  6. sqlserver修改某列为自增

    sqlserver如果建表的时候不设自增,之后是没法直接修改的,需要先删再重设: alter table 表名 drop column ID alter table 表名 add ID int ide ...

  7. Docker Compose文件详解 V2

    Compose file reference 语法: web:      build: ./web      ports:      - "5000:5000"      volu ...

  8. 17.3.13---sys.argv[]用法

    1------sys.argv[]是用来获取命令行参数, sys.argv[0]表示代码本身文件路径,因此要从第二个即sys.argv[1]开始去参数 例如创建一个文件: import sys pri ...

  9. hdu2896&&3065

    题:http://acm.hdu.edu.cn/showproblem.php?pid=2896 分析:ac自动机模板 注意细节,1.128个ascii码都要: 2.只要关键码含有只输出一个编号就行 ...

  10. Python数据分析与展示第3周学习笔记(北京理工大学 嵩天等)

    入门学习马上结束辽. 1.Pandas库 import pandas as pd 两个数据类型:Series,DataFrame Series类型:数据+索引 自定义索引 b = pd.Series( ...