I'm going crazy with pointers in C at the moment. I have the following two multi-dimensional arrays:
int num0[5][3] =
{ {0,1,0},
{1,0,1},
{0,1,0},
{1,0,1},
{0,1,0}
};
int num1[5][3] =
{ {1,1,1},
{1,0,1},
{0,1,1},
{0,1,0},
{1,0,0}
};
These are then packed into another array as such:
int (*numbers[])[3] = { num0, num1 };
If I then do:
printf( "Result: %d\n", numbers[0][2][2] );
I get the expected result, in this case Result: 1.
However, I'd like to assign numbers[0] to another variable. So in a modern programming language, you'd do something as simple as:
int newvar[5][3] = numbers[0];
printf( "Result: %d\n", newvar[2][2] );
Even though my pointer knowledge is limited, I know this isn't going to work (and it of course doesn't). But for the life of me I can't figure out the correct syntax to make it work (and more importantly, understand WHY it works).
If anyone out there can help me out here I'd really appreciate it!
Thanks