在多维数组ç怪异数组语法 [英] C weird array syntax in multi-dimensional arrays
问题描述
我知道这是真实的:
X [4] == 4 [X]
什么是相当于多维数组?是下面的是真的吗?
X [4] [3] == 3 [X [4] == 3 [4 [X]]
X [Y]
定义为 *(X +(Y) )
X [Y] [Z]
将成为 *(*(X +(Y))+ Z)
X [Y [Z]]
将成为 *(X +(*(Y +(Z))))
X [4] [3]
将成为 *(*(X +(4))+ 3)
将成为 *(*(X + 4)+ 3)
3 [X [4]]
将成为 *(3 +(*(X +(4))))
将成为 *(*(X + 4)+ 3)
3 [4 [X]
将成为 *(3 +(*(4 +(X))))
将成为 *(*(X + 4)+ 3)
这意味着它们都是等价的。
I've known that this is true:
x[4] == 4[x]
What is the equivalent for multi-dimensional arrays? Is the following true?
x[4][3] == 3[x[4]] == 3[4[x]]
x[y]
is defined as *(x + (y))
x[y][z]
would become *(*(x + (y)) + z)
x[y[z]]
would become *(x + (*(y + (z))))
x[4][3]
would become *(*(x + (4)) + 3)
would become
*(*(x + 4) + 3)
3[x[4]]
would become *(3 + (*(x + (4))))
would become *(*(x + 4) + 3)
3[4[x]]
would become *(3 + (*(4 + (x))))
would become *(*(x + 4) + 3)
Which means they are all equivalent.
这篇关于在多维数组ç怪异数组语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!