More Dereferencing Confusion

Hello all! My last visit was succinct and successful so I figure I have a similar problem and rather than wrack my brain, I may as well bring it here!

So I bring to you another odd programming issue:
1
2
3
4
5
6
7
8
9
10
11
12
13
class** stack[STACKSIZE];
class*  array[ARRAYSIZE];
class   perm[ARRAYSIZE]; 
//...
stack[a]=array[b];  //stack[a] points to array[b] (or similar)
array[b]=perm[c];   //array[b] points to perm[c]  (or similar)
//...

//pop() returns a class** which points to an array-index instance of that class

classvar** = pop()
//THE BELOW LINE OF CODE IS THE PROBLEM (I think)
**classvar = perm[m]


I haven't tried this yet as there's other code in the works first. However I am thinking on this guy as I'm not sure how to do it.

The idea is that a stack position points to an empty position in "array", this empty position needs to point to a to-be-used position in "perm". I pop the which position is free in "array" off the "stack" and want to point this empty position to some perm-index.

Again, thank you for reading through my odd program design; just experimenting with odd structures. Any help with understanding what's going on is much appreciated!

here goes round two!
-Erich

p.s. To sum up the problem; I have a pointer A which points to another pointer B. I wish to point B towards a position using it's handle A.
It's hard to understand you, so I'll respond just to
p.s. To sum up the problem; I have a pointer A which points to another pointer B. I wish to point B towards a position using it's handle A.


1
2
3
4
5
int i;
int *p;//a pointer that we're going to set
int **pp = &p;//a pointer that points to p

*pp = &i;//*pp is equal to p, so this is the same as p = &i. 
I think you've understood well enough though! That looks about right. I'll repost here after checking. Thanks!

If you're curious what I meant: It's a stack of object-pointer-pointers pointing to an objects in an array of object-pointers pointing to objects themselves in their own array. Visually it's akin to page-tables for a hard drive.
Topic archived. No new replies allowed.