Path: utzoo!attcan!uunet!crdgw1!uakari.primate.wisc.edu!sdd.hp.com!hplabs!hpfcso!hplisa!hpmtlx!gregs From: gregs@hpmtlx.HP.COM ($Greg_Stander) Newsgroups: comp.lang.c++ Subject: Re: new on two dimension array Message-ID: <5370002@hpmtlx.HP.COM> Date: 26 Oct 90 16:36:33 GMT References: <1990Oct17.153438.12299@swbatl.sbc.com> Organization: HP Manufacturing Test Division - Loveland, CO Lines: 36 > Novice question: how do you use new to allocate space for a two > dimension array? > > char **matrix = new ??????; Of course if dimensions are constants, this works and is usually easier. #include #include const int XMAX = 3; const int YMAX = 20; typedef char array_type[XMAX][YMAX]; main() { array_type &myarray = *(array_type *)new char[XMAX * YMAX]; // Init to some values for(int row=0; row