delorie.com/archives/browse.cgi | search |
From: | Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: BLOCKADE: multidimensional string array |
Date: | 3 Jul 2000 16:15:24 GMT |
Organization: | Aachen University of Technology (RWTH) |
Lines: | 17 |
Message-ID: | <8jqe6s$mmq$1@nets3.rz.RWTH-Aachen.DE> |
References: | <8jqb6e$li5$1 AT nnrp1 DOT deja DOT com> |
NNTP-Posting-Host: | acp3bf.physik.rwth-aachen.de |
X-Trace: | nets3.rz.RWTH-Aachen.DE 962640924 23258 137.226.32.75 (3 Jul 2000 16:15:24 GMT) |
X-Complaints-To: | abuse AT rwth-aachen DOT de |
NNTP-Posting-Date: | 3 Jul 2000 16:15:24 GMT |
Originator: | broeker@ |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
jason_hsu AT my-deja DOT com wrote: > string* rc_data; > rc_data=new string; These two lines are your problem. You allocate only *one* string, but you want to store many of them. You'ld need something like string ** rc_data = new (string*)[max_row]; for (int i = 0; i< max_row; i++) rc_data[i] = new string[max_col]; In a nutshell: you're not really using a 2D array of strings, like you said you did. You're using a 1D array with exactly one string in it. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |