当前位置:网站首页>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
边栏推荐
- Random shuffle note
- Use cve-2021-43893 to delete files on the domain controller
- Do you really understand relays?
- 基于can总线的A2L文件解析(2)
- Use optimization | points that can be optimized in recyclerview
- Serious security vulnerabilities reported by moxa mxview network management software
- 模糊查詢時報錯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
- HTB-Devel
- Tensorflow to pytorch notes; tf. gather_ Nd (x, y) to pytorch
猜你喜欢

超好用的日志库 logzero

C language beginner level - pointer explanation - paoding jieniu chapter

分布式事务

From C to capable -- use the pointer as a function parameter to find out whether the string is a palindrome character

MySql实战45讲【全局锁和表锁】

C语言初阶-指针详解-庖丁解牛篇

Kubernetes family container housekeeper pod online Q & A?

内存泄漏工具VLD安装及使用

Joking about Domain Driven Design (III) -- Dilemma
![[principles of multithreading and high concurrency: 1_cpu multi-level cache model]](/img/c7/6b5ab4ff7379bfccff7cdbb358ff8f.jpg)
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
随机推荐
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
Didi programmers are despised by relatives: an annual salary of 800000 is not as good as two teachers
Use optimization | points that can be optimized in recyclerview
Can netstat still play like this?
Check log4j problems using stain analysis
C language beginner level - pointer explanation - paoding jieniu chapter
sql server 查詢指定錶的錶結構
Xiaodi notes
Concrete CMS vulnerability
Distributed transaction
模糊查询时报错Parameter index out of range (1 > number of parameters, which is 0)
Installation and use of memory leak tool VLD
[flutter] example of asynchronous programming code between future and futurebuilder (futurebuilder constructor setting | handling flutter Chinese garbled | complete code example)
Random shuffle note
I2C subsystem (III): I2C driver
The base value is too large (the error is marked as "08") [duplicate] - value too great for base (error token is'08') [duplicate]
The solution of "the required function is not supported" in win10 remote desktop connection is to modify the Registry [easy to understand]
C语言中左值和右值的区别
xiaodi-笔记
Parameter index out of range (1 > number of parameters, which is 0)