server-api-calloc Posted on 2019-04-12 Edited on 2023-05-21 原型用于配置内存空间 123456// nmemb:要分配内存个数// size:要分配的每个内存大小//// return:// 若配置成功则返回一指针,失败则返回NULL。void *calloc(size_t nmemb,size_t size); 使用参考12345678910111213141516#include<stdlib.h>struct test{ int a[10]; char b[20];};int main(){ struct test *ptr = calloc(sizeof(struct test), 10); free(ptr); return 0;}