<<< Array Navigation | Index | C++ Standard Library algoritm header >>> |
Array initializer provides a list of array values:
char carr[ ] = { 'a', 'b', 'c', 0 }; // ok: size is calculated int iarr[ 2 ] = { 5 }; // ok: same as { 5, 0 } float fa[ 3 ] = { x, y, z }; // variable initializers ok int ibad[ 2 ] = { 1, 2, 3 }; // error: too many initializers ibad[ 2 ] = { 10, 20 }; // error: no initializer-assignments
<<< Array Navigation | Index | C++ Standard Library algoritm header >>> |