]>
Commit | Line | Data |
---|---|---|
7534721d | 1 | int x[3] = { 1 , 2, 3, 4 } ; /* Initializer block for x has 4 elements, but declared as int[3] */ |
2 | int a[3] = { 1 , 2 } ; /* Initializer block for a has 2 elements, but declared as int[3] */ | |
3 | int aa[3][3] = { { 1 , 2, 3 }, /* Initializer block for aa has 2 elements, but declared as int[3][3] */ | |
4 | { 4, 5 } } ; /* Initializer block for aa[1] has 2 elements, but declared as int [3] */ | |
5 | ||
6 | int ab[] = { 1, 2, 3 } ; | |
7 | ||
8 | char cc[3] = { 'a', 'b', 'c' } ; | |
9 | char cs[3] = "ab"; | |
10 | char cs1[3] = "abc"; /* gcc doesn't warn for this */ /* stringliteralnoroom */ | |
11 | char cs2[3] = "abcd"; /* gcc warns for this with -Wall */ /* stringliteraltoolong */ | |
12 | char cs3[3] = "a"; /* stringliteral smaller (not on default) */ | |
13 | ||
14 | char csx[3][3] = { { 'a', 'b', 'c' } , "def", "gasdf" } ; /* 2 errors */ | |
393e573f | 15 | |
16 | int a2[][2] = {{1,2},{3,4},{5,6}}; | |
17 | int a3[][2] = {{1,2},{3,4,5},{5,6}}; |