当前位置:网站首页>二维数组中的元素求其存储地址
二维数组中的元素求其存储地址
2022-07-03 02:59:00 【夏赞恩】
数组a[m][n] 按行序为主序存放
已知二维数组a[m][n]按行序为主序存放,每个元素占L个字符,其中首地址为a[x][y]地址为Loc1,元素a[i][j]的地址为:
Loc(a[i][j]) = Loc1 + [n*(i-x)+(j-y)]*L
数组a[m][n] 按列序为主序存放
已知二维数组a[m][n]按列序为主序存放,每个元素占L个字符,其中首地址为a[x][y]地址为Loc2,元素a[i][j]的地址为:
Loc(a[i][j]) = Loc2 + [m*(j-y)+(i-x)]*L
例题
(1)已知二维数组a[5][4]按行序为主序存放,每个元素占6个字符,其中首地址为a[1][1]地址为120,元素a[4][2]的地址为:
Loc(a[4][2]) = 120 + [4*(4-1)+(2-1)]*6 = 198
(2)已知二维数组a[10][20]按列序为主序存放,每个元素占1个字符,其中首地址为a[0][0]地址为120,元素a[6][12]的地址为:
Loc(a[6][12]) = 120 + [10*12+6]*1 = 246
边栏推荐
- [fluent] futurebuilder asynchronous programming (futurebuilder construction method | asyncsnapshot asynchronous calculation)
- How to select the minimum and maximum values of columns in the data table- How to select min and max values of a column in a datatable?
- TCP handshake three times and wave four times. Why does TCP need handshake three times and wave four times? TCP connection establishes a failure processing mechanism
- 超好用的日志库 logzero
- Apple releases MacOS 11.6.4 update: mainly security fixes
- 【富瀚6630编码存录像,用rtsp服务器及时间戳同步实现vlc观看录像】
- The core idea of performance optimization, dry goods sharing
- 用docker 连接mysql的过程
- Use optimization | points that can be optimized in recyclerview
- Update and return document in mongodb - update and return document in mongodb
猜你喜欢

Creation and destruction of function stack frame

Practice of traffic recording and playback in vivo

Kubernetes cluster log and efk architecture log scheme

Left connection, inner connection

分布式事务

Build a private cloud disk cloudrev

Error invalid bound statement (not found): com ruoyi. stock. mapper. StockDetailMapper. XXXX solution

sql server数据库添加 mdf数据库文件,遇到的报错

用docker 连接mysql的过程

Add automatic model generation function to hade
随机推荐
SqlServer行转列PIVOT
Deep reinforcement learning for intelligent transportation systems: a survey paper reading notes
[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
HW initial preparation
tensorflow转pytorch笔记;tf.gather_nd(x,y)转pytorch
Update and return document in mongodb - update and return document in mongodb
模糊查詢時報錯Parameter index out of range (1 > number of parameters, which is 0)
JS finds all the parent nodes or child nodes under a node according to the tree structure
Build a private cloud disk cloudrev
销毁Session和清空指定的属性
xiaodi-笔记
Tensorflow to pytorch notes; tf. gather_ Nd (x, y) to pytorch
Segmentation fault occurs during VFORK execution
[shutter] monitor the transparency gradient of the scrolling action control component (remove the blank of the top status bar | frame layout component | transparency component | monitor the scrolling
random shuffle注意
敏捷认证(Professional Scrum Master)模拟练习题-2
从C到Capable-----利用指针作为函数参数求字符串是否为回文字符
Can I use read-only to automatically implement properties- Is read-only auto-implemented property possible?
Use optimization | points that can be optimized in recyclerview
Force deduction ----- the minimum path cost in the grid