How many elements before the a[7][7] for the following 2-D array?
int a[10][10];
There are 49 elements before a[7][7], which can be calculated by 7 x 7 = 49.
二维数组一维化就是a[i*col+j],a77 一维化下标为7*10+7=77,前面是0 1 2...76共77个值
不要只盯着a[7][7]看
先看定义,int a[10][10]
那么它是个10x10的矩阵
你想想一个100人的方阵,横10竖10
索引从0开始,从第0行到第6行有70个,第7行到第7个人之前又有7个
这不是77吗