In my C++ program I am trying to initialize a 3*3*3 array of type double with all 0's. In the class header file, I declared a member
double list[3][3][3];
When I printed out the content of this array, I found that not all entries are 0 as I expected. e.g. list[1][1][1] has value 4.03158e-321
Hence I manually initialized this array to all 0's in the constructor:
list = {{{0,0,0},{0,0,0},{0,0,0}},
{{0,0,0},{0,0,0},{0,0,0}},
{{0,0,0},{0,0,0},{0,0,0}}};
This makes my program work, however, I got the compiler warning:
warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
My question is therefore
- Why does list have non-zero entries after being initialized in the header?
- Why do I get the above warning message, and how to get rid of it?
My compiler is g++ (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2, with gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)