现在的位置: 首页 > 综合 > 正文

free ()函数

2013年09月08日 ⁄ 综合 ⁄ 共 261字 ⁄ 字号 评论关闭
 

free

语法:

 

  #include <stdlib.h>

  void free( void *ptr );

功能: 函数释放指针ptr指向的空间,以供以后使用。指针ptr 必须由先前对malloc(), calloc(), realloc()的调用返回。例如:

    typedef struct data_type {

      int age;

      char name[20];

    } data;

    

    data *willy;

    willy = (data*) malloc( sizeof(data) );

    ...

    free( willy );

抱歉!评论已关闭.