请协助以下关于数组指针的问题。我有20个数组,每个数组长350个元素。我需要将20个数组中的3个地址传递给一个指针数组。 然后在我的代码中,我需要访问数组内的指针数组内的各个元素。但是我不确定语法,请评论下面的内容是否正确。将数组传递到C中的指针数组中
unsigned short Graph1[350];
unsigned short Graph2[350];
unsigned short Graph3[350];
... ... ...
unsigned short Graph19 [350];
unsigned short Graph20 [350];
unsigned short *ptr_Array[3];
...
*ptr_Array[0] = &Graph6; // Passing the address of array Graph6, into the array of pointers.
*ptr_Array[1] = &Graph11; // Passing the address of array Graph11, into the array of pointers.
*ptr_Array[2] = &Graph14; // Passing the address of array Graph14, into the array of pointers.
...
Varriable1 = *ptr_Array[1]+55 // Trying to pass the 55th element of Graph11 into Varriable1.
不是一个答案:'20个数组,每个350个元素'为什么你不使用二维数组? –
数组本身应该是一个指针,不是吗? – Rolice
@Roice数组不是一个指针。如果用于表达式或作为参数传递给函数,它会耗尽指针。 –