I have two structures that look like this:
struct Foo
{
// stuff
unsigned char data[ 256 ][ 16 ][ 16 ];
// other stuff
}
struct Bar
{
Foo* pfoo;
// other stuff
}
And I have a function which looks like:
void Funky(Bar* pbar)
{
// code
for(int i=0; i<200; i++)
{
for(int j=0; j<200; j++)
{
// code here uses pbar->pfoo->data[ a ][ c ];
}
}
}
</pre>
I''d like to alias pbar->pfoo->data like this:
<pre>
void Funky(Bar* pbar)
{
// code
unsigned char* alias = pbar->pfoo->data;
for(int i=0; i<200; i++)
{
for(int j=0; j<200; j++)
{
// code here now uses alias[ a ][ c ];
}
}
}
</pre>
But I cannot do the above alias, because I lose dimensional information. Is there a way to cast ''alias'' so the compiler knows I want the dimensions 256*16*16 … ?