Author: Dave Gomboc
Date: 04:01:10 07/17/03
Go up one level in this thread
On July 17, 2003 at 05:06:16, Uri Blass wrote:
>Note that the name of the arrays that I have is different but I replaced the
>names to make it easy to understand the problem.
>
>I have an array A[64][8]
>
>I want to replace it by 8 arrays A0[64],A1[64],...A7[64] when A[i][j]=Aj[i]
>
>What is the best way to do it?
I think you want something like
typedef /* your type here */ element_type;
element_type big_array[8][64];
const element_type zeroth_array [64] = big_array[0];
const element_type first_array [64] = big_array[1];
const element_type second_array [64] = big_array[2];
const element_type third_array [64] = big_array[3];
const element_type fourth_array [64] = big_array[4];
const element_type fifth_array [64] = big_array[5];
const element_type sixth_array [64] = big_array[6];
const element_type seventh_array[64] = big_array[7];
Then you can refer either to big_array[0][n] or to zeroth_array[n].
The syntax is probably not exactly correct, my machine is busy so I didn't put
it through a compiler. It's just to give you the idea. Note especially though
that here A[i][j] = Ai[j], not Aj[i].
Possibly introducting a typedef for an 64-element array of element_type would be
worthwhile also.
Dave
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.