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. lvm镜像卷

    镜像能够分配物理分区的多个副本,从而提高数据的可用性.当某个磁盘发生故障并且其物理分区变为不可用时,你仍然可以访问可用磁盘上的镜像数据.LVM在逻辑卷内执行镜像. 系统版本 # cat /etc/ce ...

  2. UML-从需求到设计--迭代进化

    按照UP原则,初始阶段做10%的需求,而细化阶段开始为这10%的需求设计解决方案.后续章节介绍如何设计.

  3. Linux系统的限制

    1.总结系统限制有:    /proc/sys/kernel/pid_max #查系统支持的最大线程数,一般会很大,相当于理论值    /proc/sys/kernel/thread-max    m ...

  4. vue执行期间的函数

    先放上vue官方给的函数图

  5. flask web实战1.27

    1.在pycharm的terminal中输入 生成requirements.txt文件 pip freeze > requirements.txt 安装requirements.txt依赖 pi ...

  6. 题解【语文1(chin1)- 理理思维】

    link 喵~珂朵莉树AC 珂朵莉树?见此处~ 这数据结构太暴力了,所以不讲了 Code: #include<iostream> #include<cstdio> #inclu ...

  7. [USACO09MAR]向右看齐Look Up(单调栈、在线处理)

    https://www.luogu.org/problem/P2947 题目描述 Farmer John's N (1 <= N <= 100,000) cows, convenientl ...

  8. LeetCode——735.行星碰撞

    给定一个整数数组 asteroids,表示在同一行的行星. 对于数组中的每一个元素,其绝对值表示行星的大小,正负表示行星的移动方向(正表示向右移动,负表示向左移动).每一颗行星以相同的速度移动. 找出 ...

  9. mysql之DTS的那些事

    最近才考虑数据库迁移,想起了之前做DTS踩过的那些坑. 基于数据库迁移,比如从源A库迁移到源B库,包括但不限于数据库上云. 数据库迁移方案有两种场景: (1).停机迁移方案 这种方案是允许停服的场景, ...

  10. 异常处理和UDP协议

    一.什么是异常? 程序在运行过程中出现了不可预知的错误,并且该错误没对应的处理机制,那么就会以异常的形式表示出来, 造成的影响就是整个程序无法再正常的运行,抛出异常. 二.异常的结构: 1:异常的类型 ...