当前位置:网站首页>Find the storage address of the elements in the two-dimensional array
Find the storage address of the elements in the two-dimensional array
2022-07-03 03:00:00 【Shazanen】
List of articles
Array a[m][n] Store in main order in line order
Known two-dimensional array a[m][n] Store in main order in line order , Each element accounts for L Characters , The first address is a[x][y] The address is Loc1, Elements a[i][j] The address for :
Loc(a[i][j]) = Loc1 + [n*(i-x)+(j-y)]*L
Array a[m][n] Store in the main order according to the column order
Known two-dimensional array a[m][n] Store in the main order according to the column order , Each element accounts for L Characters , The first address is a[x][y] The address is Loc2, Elements a[i][j] The address for :
Loc(a[i][j]) = Loc2 + [m*(j-y)+(i-x)]*L
Example
(1) Known two-dimensional array a[5][4] Store in main order in line order , Each element accounts for 6 Characters , The first address is a[1][1] The address is 120, Elements a[4][2] The address for :
Loc(a[4][2]) = 120 + [4*(4-1)+(2-1)]*6 = 198
(2) Known two-dimensional array a[10][20] Store in the main order according to the column order , Each element accounts for 1 Characters , The first address is a[0][0] The address is 120, Elements a[6][12] The address for :
Loc(a[6][12]) = 120 + [10*12+6]*1 = 246
边栏推荐
- 超好用的日志库 logzero
- HW initial preparation
- Le processus de connexion mysql avec docker
- Use cve-2021-43893 to delete files on the domain controller
- 从输入URL到页面展示这中间发生了什么?
- How do you adjust the scope of activerecord Association in rails 3- How do you scope ActiveRecord associations in Rails 3?
- Check log4j problems using stain analysis
- 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
- 你真的懂继电器吗?
- Baidu map - surrounding search
猜你喜欢
Distributed transaction
Add automatic model generation function to hade
The Linux server needs to install the agent software EPS (agent) database
Practice of traffic recording and playback in vivo
HTB-Devel
Opengauss database development and debugging tool guide
Your family must be very poor if you fight like this!
"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
Random shuffle note
What is the way out for children from poor families?
随机推荐
HW initial preparation
超好用的日志库 logzero
I2C 子系统(四):I2C debug
Source code analysis | resource loading resources
Use optimization | points that can be optimized in recyclerview
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
Kubernetes cluster log and efk architecture log scheme
C language beginner level - pointer explanation - paoding jieniu chapter
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?
Kubernetes family container housekeeper pod online Q & A?
Opengauss database development and debugging tool guide
Can netstat still play like this?
xiaodi-笔记
Didi programmers are despised by relatives: an annual salary of 800000 is not as good as two teachers
Installation and use of memory leak tool VLD
Global and Chinese ammonium dimolybdate market in-depth analysis and prospect risk prediction report 2022 Edition
Counter统计数量后,如何返回有序的key
Why choose a frame? What frame to choose
Add MDF database file to SQL Server database, and the error is reported
docker安装redis