www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

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

↑ ↓ ← 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
↑ ↓ → 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