zoukankan      html  css  js  c++  java
  • free函数

    free函数
    原型: void free(void *ptr)
    功 能: 释放ptr指向的存储空间。被释放的空间通常被送入可用存储区池,以后可在调用malloc、realloc以及calloc函数来再分配。
    程序例:
    #include <string.h>
    #include <stdio.h>
    #include <malloc.h>
    #include <stdlib.h>
    int main(void)
    {
    char *str;
    /* allocate memory for string */
    str = (char *)malloc(10);
    if(str == NULL){
    perror("malloc");
    exit(1);
    }
    /* copy "Hello" to string */
    strcpy(str, "Hello");
    /* display string */
    printf("String is %s ", str);
    /* free memory */
    free(str);
    return 0;
    }
  • 相关阅读:
    sobel
    构造函数
    #pragma once & ifnde
    #pragma comment
    SET容器
    重载[] int& operator[ ]( )
    仿函数 operator()()
    remove_if erase
    vector
    map
  • 原文地址:https://www.cnblogs.com/getyoulove/p/3945219.html
Copyright © 2011-2022 走看看