![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c语言
文章平均质量分 71
flying_fish_233
真诚做人,认真做事
展开
-
malloc()函数详解
转自:http://blog.csdn.net/xw13106209/article/details/4962479一、原型:extern void *malloc(unsigned int num_bytes);头文件:#include #include<stdio.h> #include<malloc.h> int main() { char *p; p=(char *)mallo转载 2016-02-13 16:07:21 · 493 阅读 · 0 评论 -
free()函数
c语言中经常需要给指针变量分配内存空间,需要用到一组函数:malloc()和free()使用的时候需要包含头文件stdlib.hmalloc()比较好理解,主要关注下free()函数,看下面一段代码:char str = (char ) malloc (100);strcpy(str, “hello world!”);free(str);strcpy(str, “is it OK?”);printf转载 2016-02-13 16:22:59 · 3105 阅读 · 0 评论