当前位置:网站首页>二维数组中的元素求其存储地址
二维数组中的元素求其存储地址
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] listview list (map method description of list set | vertical list | horizontal list | code example)
- Unity3d human skin real time rendering real simulated human skin real time rendering "suggestions collection"
- How to limit the size of the dictionary- How to limit the size of a dictionary?
- Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
- SQL server queries the table structure of the specified table
- js根据树结构查找某个节点的下面的所有父节点或者子节点
- 【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)
- What does "where 1=1" mean
- 你真的懂继电器吗?
- 模糊查詢時報錯Parameter index out of range (1 > number of parameters, which is 0)
猜你喜欢
Kubernetes cluster log and efk architecture log scheme
The Linux server needs to install the agent software EPS (agent) database
Add some hard dishes to the interview: how to improve throughput and timeliness in delayed task scenarios!
敏捷认证(Professional Scrum Master)模拟练习题-2
左连接,内连接
【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)
I2C 子系統(四):I2C debug
From C to capable -- use the pointer as a function parameter to find out whether the string is a palindrome character
分布式事务
Kubernetes cluster log and efk architecture log scheme
随机推荐
tensorflow转pytorch笔记;tf.gather_nd(x,y)转pytorch
【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)
What is the way out for children from poor families?
I2C 子系统(四):I2C debug
"Analysis of 43 cases of MATLAB neural network": Chapter 43 efficient programming skills of neural network -- Discussion Based on the characteristics of the new version of MATLAB r2012b
open file in 'w' mode: IOError: [Errno 2] No such file or directory
sql server数据库添加 mdf数据库文件,遇到的报错
SQL server queries the table structure of the specified table
sql server 查詢指定錶的錶結構
复选框的使用:全选,全不选,选一部分
Unity3d human skin real time rendering real simulated human skin real time rendering "suggestions collection"
模糊查询时报错Parameter index out of range (1 > number of parameters, which is 0)
销毁Session和清空指定的属性
Kubernetes family container housekeeper pod online Q & A?
js根据树结构查找某个节点的下面的所有父节点或者子节点
Add automatic model generation function to hade
Use optimization | points that can be optimized in recyclerview
ComponentScan和ComponentScans的区别
Installation and use of memory leak tool VLD
leetcode540