用大括号和不带大括号初始化 char
数组有什么区别?
char arr[] = {"string"};
或
char arr[] = "string";
最佳答案
没有区别。 C99 直接解决了这个问题,6.7.8 初始化:
- An array of character type may be initialized by a character string literal, optionally enclosed in braces. Successive characters of the character string literal (including the terminating null character if there is room or if the array is of unknown size) initialize the elements of the array.
(强调我的。)
关于c - 初始化char数组的不同方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52232560/