例1-2.c
来自「C语言高级编程及实例剖析/王为青, 刘变红编著 ISBN号: 978-7」· C语言 代码 · 共 19 行
C
19 行
/* Note:Your choice is C IDE */
#include <stdio.h>
#include <stdlib.h>
main()
{
char * str;
if((str=(char * )malloc(10))==NULL)
{
printf("\n Allocation is failed.");
exit(1);
}
else
{
printf("\n Input the string:");
gets(str);
}
puts(str);
free(str); /* 释放并回收由malloc() 分配的自由内存 */
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?