【发布时间】:2021-02-26 00:20:54
【问题描述】:
为什么 C 中的 char 数组不需要元素说明符,而整数数组则需要?
例如:
#include <stdio.h>
int main(void){
char array1[100];
int array2[100] = {1,2,3,4};
fgets(array1, 100, stdin);
printf("%s", array1); // This prints the string inputted without a specifier
printf("%d ", array2); // This throws an error since there is no specifier
return 0;
}
【问题讨论】: