Advertisement

03.15.2004 at 01:22PM PST, ID: 20919753
[x]
Attachment Details

nested dynamic multidimensional arrays

Asked by dmatter in C Programming Language

Tags:

OK, I'm having trouble accessing a nested 2dimensional array.

First of all I an create a dynamic table of pointers to structures and allocate space for the structures, I could call this dynamic array something like 'array' for simplicity.  So if I want to access an element 'size' within the structure located at (2, 4) I could simply do:
   array[2][4].size

I can do this and it works fine, but I actually have another dynamic 2dimensional defined in the structure, lets call it 'doh'.
I am (I think) able to allocate space for this array but when I try to access an element like this:
  array[2][4].doh[1][6].element
It just crashes the program completely!

What am I doing wrong here or if it's alright then what might be the cause of it?  I trapsed all through my program and can't find anything to account for this.

I've given all the points I have left for this question (at the time of writing) but (knowing me) I bet it'll be a simple syntaxial error anyway :]

DmatterStart Free Trial
 
 
[+][-]03.15.2004 at 01:40PM PST, ID: 10601323

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.15.2004 at 09:28PM PST, ID: 10603561

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.15.2004 at 09:29PM PST, ID: 10603566

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.15.2004 at 10:44PM PST, ID: 10603863

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C Programming Language
Tags: programming
Sign Up Now!
Solution Provided By: skypalae
Participating Experts: 3
Solution Grade: A
 
 
[+][-]03.15.2004 at 10:56PM PST, ID: 10603919

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.16.2004 at 01:42PM PST, ID: 10610418

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32