[C] 分配主存储器 →→→→→进入此内容的聊天室

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

回复 "分配主存储器"

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

captcha