1.void *calloc(size_t nmemb,size_t size);

#include<stdlib.h>

struct test

{

int a[10];

char b[20];

}

main()

{

struct test *ptr=calloc(sizeof(struct test),10);

}

2.

#include<string.h>

void bzero(void *s,int n);

bzero()会将参数s所指的内存区域前n个字节,全部设为零值。

3.void * memset (void *s ,int c, size_t n);

#include <string.h>

main()

{

char s[30];

memset (s,'A',sizeof(s));

s[30]='\0';//如果没有这句话,输出30个A后还会输出一些乱码

printf("%s\n",s);

}

相关文章:

  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2021-11-30
  • 2021-12-06
  • 2022-02-17
  • 2022-12-23
猜你喜欢
  • 2021-10-14
  • 2021-12-12
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
相关资源
相似解决方案