多维数组在内存中的排列方式

对于多维数据,在Fortran中,采用Column-major order;在C/C++中,采用Row-major order。看下图就明白了:

gfx3

另外,Fortran数组索引是从1开始的,C/C++是从0开始的,Java/C#也是从0开始的。不过,Fortran数组的开始索引是可以重新定义的,甚至从负数开始也可以,估计是编译器替用户作偏移了。

Advertisements
此条目发表在未分类分类目录。将固定链接加入收藏夹。

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s