Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > BOOK: Ivor Horton's Beginning Visual C++ 2010
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Ivor Horton's Beginning Visual C++ 2010
This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2010 by Ivor Horton; ISBN: 9780470500880
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2010 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 30th, 2015, 11:35 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to use multidimensional dynamic array

When develop a program which uses the 5-dimensions dynamic array, meet the problem.

The compile process is OK. During running ,the message "IIIIIIIIIIIII" appears, but the message "JJJJJJJJJJJJJJJJJJJ" does not appear. Instead ,the following warning appears:

Debug Assertion Failed!

What causes this problem? How to solve this problem.

Anybody could help me?


The following is the code:

void CTestDynamicArrayDlg::OnBnClickedButton1()
// TODO: Add your control notification handler code here
int N1=5;
int N2=5;
int N3=5;
int N4=5;
int N5=5;

double *****A1,*****A2;
double *****A3,*****A4;
double *****A5;

A1=new double****[N1];
A2=new double****[N1];
A3=new double****[N1];
A4=new double****[N1];
A5=new double****[N1];
for (int i=0;i<N1;i++)
A1[i]=new double***[N2];
A2[i]=new double***[N2];
A3[i]=new double***[N2];
A4[i]=new double***[N2];
A5[i]=new double***[N2];
for (int i=0;i<N1;i++)
for (int j=0;j<N2;j++)
A1[i][j]=new double**[N3];
A2[i][j]=new double**[N3];
A3[i][j]=new double**[N3];
A4[i][j]=new double**[N3];
A5[i][j]=new double**[N3];
for (int i=0;i<N1;i++)
for (int j=0;j<N2;j++)
for (int p=0;p<N3;p++)
A1[i][j][p]=new double*[N4];
A2[i][j][p]=new double*[N4];
A3[i][j][p]=new double*[N4];
A4[i][j][p]=new double*[N4];
A5[i][j][p]=new double*[N4];
for (int i=0;i<N1;i++)
for (int j=0;j<N2;j++)
for (int p=0;p<N3;p++)
for (int q=0;q<N4;q++)
A1[i][j][p][q]=new double[N5];
A2[i][j][p][q]=new double[N5];
A3[i][j][p][q]=new double[N5];
A4[i][j][p][q]=new double[N5];
A5[i][j][p][q]=new double[N5];

for (int i=0;i<N1;i++)
for (int j=0;j<N2;j++)
for (int p=0;p<N3;p++)
for (int q=0;q<N4;q++)
for (int r=0;r<N5;r++)

for (int i=0;i<N1;i++)
for (int j=0;j<N2;j++)
for (int p=0;p<N3;p++)
for (int q=0;q<N4;q++)
delete[] A1[i][j][p][q];
delete[] A2[i][j][p][q];
delete[] A3[i][j][p][q];
delete[] A4[i][j][p][q];
delete[] A5[i][j][p][q];
for (int i=0;i<N1;i++)
for (int j=0;j<N2;j++)
for (int p=0;p<N3;p++)
delete[] A1[i][j][p];
delete[] A2[i][j][p];
delete[] A3[i][j][p];
delete[] A4[i][j][p];
delete[] A5[i][j][p];
for (int i=0;i<N1;i++)
for (int j=0;j<N2;j++)
delete[] A1[i][j];
delete[] A2[i][j];
delete[] A3[i][j];
delete[] A4[i][j];
delete[] A5[i][j];
for (int i=0;i<N1;i++)
delete[] A1[i];
delete[] A1[i];
delete[] A3[i];
delete[] A3[i];
delete[] A5[i];
delete[] A1;
delete[] A2;
delete[] A3;
delete[] A4;
delete[] A5;


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multidimensional array problem rumceisz Excel VBA 1 April 29th, 2012 01:13 PM
multidimensional array help for a newbie grahama PHP Databases 1 May 13th, 2008 09:41 AM
Multidimensional Array macsham Beginning PHP 2 February 24th, 2005 03:30 PM
Multidimensional array in ch9 willburke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 November 2nd, 2004 04:44 PM
Multidimensional Array help grahama Beginning PHP 0 June 12th, 2004 09:01 PM

All times are GMT -4. The time now is 12:42 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.