strdup
来源:互联网 发布:几米漫画推荐知乎 编辑:程序博客网 时间:2024/05/20 03:46
头文件:#include <string.h>
定义函数:char * strdup(const char *s);
定义函数:char * strdup(const char *s);
使用man来看一下:
The strdup() function returns a pointer to a new string which is a duplicate of the string s. Memory for the new string is obtained
with malloc(3), and can be freed with free(3).
The strndup() function is similar, but copies at most n bytes. If s is longer than n, only n bytes are copied, and a terminating
null byte ('\0') is added.
返回值:返回一字符串指针,该指针指向复制后的新字符串地址。若返回NULL 表示内存不足。
这个函数的应用场景一般是在保存永久信息,也就是说一般不会使用free来释放,比如说公共的配置信息。
0 0
- strdup
- strdup
- strdup
- strdup
- strdup
- strdup
- strdup
- strdup
- strdup
- strdup
- strdup
- strdup
- strdup
- strdup
- strdup()
- strdup
- strdup
- strdup函数
- 学习KNN算法体会和总结
- 如何获取最新的EI期刊杂志目录
- 19. Remove Nth Node From End of List
- 关于Hamming Weight
- iOS之PhoneGap开发环境
- strdup
- windows 用户变量和系统变量的区别
- eclipse for andriod 安装ADT
- JAVA 与 Python 变量赋值的不同
- 编写python代码
- 佟刚老师《Spring4视频教程》学习笔记(8)
- C数组,指针
- css学习记录3
- poj 2182 :Lost Cows (线段树)