memset
来源:互联网 发布:tengine nginx 对比 编辑:程序博客网 时间:2024/05/14 17:33
function
<cstring>
memset
void * memset ( void * ptr, int value, size_t num );
Fill block of memory
Sets the first num bytes of the block of memory pointed by ptr to the specified value (interpreted as an unsigned char).Parameters
- ptr
- Pointer to the block of memory to fill.
- value
- 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.
- num
- Number of bytes to be set to the value.
size_t is an unsigned integral type.
Return Value
ptr is returned.Example
1234567891011
/* memset example */#include <stdio.h>#include <string.h>int main (){ char str[] = "almost every programmer should know memset!"; memset (str,'-',6); puts (str); return 0;}
Output:
------ every programmer should know memset!
See also
- memcpy
- Copy block of memory (function )
- strncpy
- Copy characters from string (function )
- memcmp
- Compare two blocks of memory (function )
0 0
- memset
- memset
- memset
- memset
- memset
- memset
- memset
- memset
- memset
- memset
- memset
- memset
- memset
- memset
- memset
- memset
- memset
- memset
- MySQL 事务的学习整理
- API Guides:Fragment
- 手机模拟触摸板的简单实现Java版
- Java学习之Iterator(迭代器)的一般用法 (转)
- Struts2拦截器原理理解
- memset
- 2014编程之美资格赛 题目3 : 格格取数
- 【开源】博客导出工具
- uva 10367 - Equations(模拟+数论)
- Oracle优化器介绍
- 第七周项目3-成员函数、友元函数和一般函数的区别
- 携程编程——括号匹配1002
- 深入分析request_irq的dev_id参数作用
- 什么是字符串常量池?