docs: update

This commit is contained in:
KazooTTT
2024-11-26 00:22:13 +08:00
parent 92fc8c7861
commit 504a9414e8
58 changed files with 2584 additions and 46 deletions

View File

@ -0,0 +1,22 @@
---
title: 2023-02-21 星期二
date: 2023-02-21T00:00:00.000Z
author: KazooTTT
tags:
- 日记
slug: 2023-02-21-tue
published: true
description: >-
在2023年2月21日的内容中讨论了数组元素索引为何从0开始编号的问题。根据地址计算公式索引实际上代表了内存地址的偏移量首个元素的地址偏移量为0因此索引从0开始是合理的。文章中还提供了一张图示进一步解释了这一概念。
rinId: 23
category: 日记-2023-02
---
# 2023-02-21 星期二
## 数组
[4.1. 数组Array - Hello 算法 (hello-algo.com)](https://www.hello-algo.com/chapter_array_and_linkedlist/array/#411)
**为什么数组元素索引从 0 开始编号?**  根据地址计算公式,**索引本质上表示的是内存地址偏移量**,首个元素的地址偏移量是  0 那么索引是  0  也就很自然了。
![Pasted image 20230221221853](https://pictures.kazoottt.top/2024/04/20240407-170214c87b99ed229900334e27d6db5d.png)