How does it work (sets all values to 0)?
int array[28]= {0};
and why doesn’t it work (does not set all values to 4, but only the first value sets 4, and the others set 0)?
int array[28]= {4};
Elements that are not initialized are set to 0. In the first case, you initialize it by giving it a value of 0, and the remainder defaults to initializing to 0. In your second case, the first values are initialized to 4 and the rest as 0. The standard says:
, , , , , , , , .
C , , .
int array[28]= {0}; 28 ints 0. , , 0 ints.
int array[28]= {4}; . 4, , , .
, .
ISO/IEC: 9899 ( c99) TC3:
6.7.8
[...]
21 , , , , , , , , .
10: ( )
10 , . ,- , ;- , ( ) ;- , () ;- , () .
10 , . ,
- , ;
- , ( ) ;
- , () ;
- , () .
, , .
int array[5] = {0}
0
int array[5] = {1,2,3}
1, , 3 0.
Source: https://habr.com/ru/post/1610257/More articles:Настройка ширины ячейки на основе текста - UICollectionView - iOS - iosPrevious adjacent selector selector? - jquerySceneKit: Shademodifier ignores user-defined global function in Xcode 7 - iosConverting values below a threshold value to 1 - rCompiling ffmpeg results in an error in stdlib.h - cDebug C ++ dll from C # - c ++Can't change project torch ear version to maven error 1.3 in eclipse? - javaDisplaying a sprinkler screen in ionic - angularjshttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1610261/safari-skips-website-header-and-goes-to-content&usg=ALkJrhi-3_z-zCCr-dDr7VTDs80u_qxD_gВерсия пакета EntityFramework = "6.1.3" и версия веб-версии 6.0.0.0? - c#All Articles