www.digitalmars.com         C & C++   DMDScript  

c++ - Initialization of arrays at the time of declaration not supported?

reply Stefano <Stefano_member pathlink.com> writes:
This C line should work:
int grades[NUM_STUDENTS][NUM_TESTS] = { {55, 60, 65},
{95, 90, 85} };
But i get errors using dmc. Is array initialization at the time of declaration
not supported?
Thank you

Best Regards
Stefano
Mar 18 2006
parent Bertel Brander <bertel post4.tele.dk> writes:
Stefano wrote:
 This C line should work:
 int grades[NUM_STUDENTS][NUM_TESTS] = { {55, 60, 65},
 {95, 90, 85} };
 But i get errors using dmc. Is array initialization at the time of declaration
 not supported?
I have no problem with this code: #include <stdio.h> #define NUM_STUDENTS 2 #define NUM_TESTS 3 int main() { int grades[NUM_STUDENTS][NUM_TESTS] = {{55, 60, 65}, {95, 90, 85}}; } Which errors du you get? -- Absolutely not the best homepage on the net: http://home20.inet.tele.dk/midgaard But it's mine - Bertel
Mar 18 2006