www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/28/06:24:21

From: "Dan Goodman" <dog AT fcbob DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Dynamic Arrays and C++
Date: Fri, 26 Jun 1998 21:55:09 +0100
Message-ID: <898894440.5848.0.nnrp-03.9e989aee@news.demon.co.uk>
References: <AEA709B50D3807D4 DOT DBB9E9D19B2BCC95 DOT 9840599F888D1195 AT library-proxy DOT airnews DOT net> <3592CD96 DOT 78DB0FBC AT ipass DOT net>
NNTP-Posting-Host: fcbob.demon.co.uk
Lines: 24
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

>It must be a typo in your book (or it's just a bad book).  The following
>is one way to do it:
>
>   int **test;
>   test = new int *[8];
>   for (int i=0;i<8;i++)
>       test[i] = new int[8];



Having done this would we just use the variable like this:

 x = test[a][b]

For instance, and would the delete procedure be like this?

for(i=0;i<8;i++)
 delete test[i];
delete test;

Thanks,
Dan


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019