mirror of
https://github.com/KazooTTT/kazoottt-blog.git
synced 2025-06-24 03:01:31 +08:00
1014 B
1014 B
title, slug, date, author, tags, published, description, rinId, toAstro, category
title | slug | date | author | tags | published | description | rinId | toAstro | category | |
---|---|---|---|---|---|---|---|---|---|---|
2023-02-21 星期二 | diary-2023-02-21 | 2023-02-21 | KazooTTT |
|
true | 在2023年2月21日的内容中,讨论了数组元素索引为何从0开始编号的问题。根据地址计算公式,索引实际上代表了内存地址的偏移量,首个元素的地址偏移量为0,因此索引从0开始是合理的。文章中还提供了一张图示,进一步解释了这一概念。 | 23 | false | 日记-2023-02 |
2023-02-21 星期二
数组
4.1. 数组(Array) - Hello 算法 (hello-algo.com)
为什么数组元素索引从 0 开始编号? 根据地址计算公式,索引本质上表示的是内存地址偏移量,首个元素的地址偏移量是 0 ,那么索引是 0 也就很自然了。