mirror of
https://github.com/KazooTTT/kazoottt-blog.git
synced 2025-06-25 03:31:29 +08:00
docs: update
This commit is contained in:
22
src/content/post/日记/2023/02/2023-02-21.md
Normal file
22
src/content/post/日记/2023/02/2023-02-21.md
Normal 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 也就很自然了。
|
||||
|
||||

|
Reference in New Issue
Block a user