|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: C++ help
============================================================ "So many interesting emails. So little time to read them. Thanks to myTopica, I can find what I want, when I want it." So can you. http://click.topica.com/aaabBCbUrGczbU68iFa/register ============================================================ hey- EnderWiggin already explained how to do this using a 1 dimensional array. There is, however, a way to actually make a dynamic 2 dimensional array, though it does require a little more code. Let's say you want an array with dims of A x B you do something like this: char * map[A]; for (int loop=0; loop < A; loop++) map[loop] = new char[B]; That will create a 2D array with size A x B, but as I mentioned before, it does take a little more code and time, which means it's not as efficient as Ender's solution. -Brian > >I was wondering if anyone can tell me how i can create a dynamically >allocated 2-dimensional array of chars. i have: > >char *dynamic_map; > >in my declarations, and then later in a function: > >dynamic_map = new char[ms_x] [ms_y]; (ms_x and ms_y passed into function) > >but this gives me a 'constant expression required' error. >any help would be appreciated. >tom > _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com ------------------------------------------------------------ Where do you Find New & Exciting Lists? Right Here! Join FindLists-Subscribe@Topica.com to Find New Lists! Promoted by List Owners who are Actively Seeking New Members ____________________________________________________________ T O P I C A -- Learn More. Surf Less. Newsletters, Tips and Discussions on Topics You Choose. http://www.topica.com/partner/tag01
|
|