[C] 释放已分配的块 free →→→→→进入此内容的聊天室

来自 , 2019-05-30, 写在 C, 查看 102 次.
URL http://www.code666.cn/view/635440af
  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <alloc.h>
  4.  
  5. int main ( void )
  6. {
  7.         char *str;
  8.  
  9.         /* allocate memory for string */
  10.         str = malloc ( 10 );
  11.  
  12.         /* copy "Hello" to string */
  13.         strcpy ( str, "Hello" );
  14.  
  15.         /* display string */
  16.         printf ( "String is %s\n", str );
  17.  
  18.         /* free memory */
  19.         free ( str );
  20.  
  21.         return 0;
  22. }
  23.  

回复 "释放已分配的块 free"

这儿你可以回复上面这条便签

captcha