int outer[4][3] = {
{ 1, 2, 3 },
{ 2, 3, 5 },
{ 1, 4, 9 },
{ 10, 20, 30 }
};
及びIは、outer
内部のようなものをn番目の一次元アレイに対するポインタ/配列を取得したいような配列
void foo() {
printf("%d %d %d\n", outer[1][0], outer[1][1], outer[1][2]);
int inner[3] = outer[1]; /* Is there some way to do this assignment? */
printf("%d %d %d\n", inner[0], inner[1], inner[2]);
/* so that this line gives the same output as the first */
}
もちろん、これはポインタの数学では可能ですが、私は忘れてしまったこのための構文があるように感じます。配列へのポインタの場合
int * inner =&outer [1] [0]; – user3528438