#: 17152 S12/OS9/68000 (OSK)
23-Nov-92 03:35:15
Sb: #17141-12
Fm: Mark Griffith 76070,41
To: Bob van der Poel 76510,2203 (X)
Bob,
> int (*indexes)[KEYS2];
>
> I need to cast p to the type of indexes. Nothing I try seems to work. I
> thought that "indexes=(int**)p" would work...
>
The declaration int (*indexes)[26] is different than int *indexes[26]. The
latter making indexes an array of 26 pointers pointing to 26 integers. The
first is a pointer pointing to an array of 26 integers. It is explained more
clearly like this: indexes[][26]. So it really is a form of a
multi-dimensional array. You would access the array like this:
var = indexes[i] which is the same as var = &indexes[0][i]
So I don't think you can assign a value to indexes since it really isn't a
pointer. You could do something like int *idx = &indexes and then assign a
value to idx. Play around with that and see what happens.
I had to look around for an answer to this one. Found it in my Plum Hall book
"Reliable Data Structures in C".
/*------------- /\/\ark -------------*/
|