Feb 16, 2009 at 9:59pm
I tried your code (using std::string) and got no problem...
BTW, where do you delete the dynamically allocated memory?
Last edited on Feb 16, 2009 at 10:02pm
Feb 16, 2009 at 10:01pm
The problem could be with the sizes ( rows and columns )
Feb 16, 2009 at 10:25pm
OOps, now I feel chicky...
I figured out that the code works fine when I remove these lines(fills the corner with zero's):
1 2 3 4
|
for(int i=0;i<rows;i++){b[i][0]="0";}
for(int i=0;i<rows;i++){b[i][columns-1]="0";}
for(int i=0;i<columns;i++){b[0][i]="0";}
for(int i=0;i<columns;i++){b[rows][i]="0";}
|
I forgot to change "rows" to "rows -1", and so I got outside the array-boundaries.
Thanks anyway for your help
Last edited on Feb 16, 2009 at 10:28pm