See https://gcc.gnu.org/onlinedocs/gcc-4.4.4/gcc/Designated-Inits.html
And here is one more tips.
Sometimes, you may want to initialize all array element with same value.
Then, you can do it as follows if you are using GCC.
static const int arr[10] = {[0 ... (sizeof(arr)/sizeof(arr[0]) - 1)] = 10};
'Language > C&C++' 카테고리의 다른 글
[Macro] '##' macro operator (0) | 2015.02.11 |
---|---|
'malloc' and 'Segmentation fault' (0) | 2014.07.25 |
[Linux] Using named pipe in linux (주의할 점) (0) | 2014.01.09 |
[c/c++] file copy using 'sendfile' on linux. (0) | 2013.12.17 |
일반 file에 대한 select/poll... (0) | 2013.11.14 |