电脑程序,分配主存储器。
calloc_calloc() -名称
函数名: calloc
功能: 分配主存储器
用法: void *calloc(size_t nelem, size_t elsize);
calloc_calloc() -程序例
#include <stdio.h>
#include <alloc.h>
int main(void)
{
char *str = NULL;
/* allocate memory for string */
str = calloc(10, sizeof(char));
/* copy "Hello" into string */
strcpy(str, "Hello");
/* display string */
printf("String is %sn", str);
/* free memory */
free(str);
return 0;
}
