请输入您要查询的百科知识:

 

词条 calloc
释义

§ 函数名

calloc

§ 功能

分配主存储器

§ 语句

void *calloc(size_t nelem, size_t elsize);

§ 程序演示

#include

#include

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 %s\", str);

/* free memory */

free(str);

return 0;

}

随便看

 

百科全书收录594082条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2024/9/21 22:43:45