qfedu-c-level/day11/d4.c

16 lines
305 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h> // memset
int main()
{
char *name = NULL;
name = (char *)calloc(4, 8 * sizeof(char)); // 说明: 4 * 8 = 32
if (NULL == name)
perror("calloc");
scanf("%s", name);
printf("%s\n", name);
free(name);
return 0;
}