From 45d293438626180ccf2f4f58ac83eb5824cebfcb Mon Sep 17 00:00:00 2001 From: C_YouShao <2936840566@qq.com> Date: Wed, 21 Dec 2022 16:25:29 +0800 Subject: [PATCH 1/2] add initialization of C++ arrays --- docs/chapter_data_structure/data_and_memory.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/chapter_data_structure/data_and_memory.md b/docs/chapter_data_structure/data_and_memory.md index 930f3762..5d492246 100644 --- a/docs/chapter_data_structure/data_and_memory.md +++ b/docs/chapter_data_structure/data_and_memory.md @@ -57,7 +57,11 @@ comments: true === "C++" ```cpp title="" - + /* 使用多种「基本数据类型」来初始化「数组」 */ + int numbers[5] = {0}; + float decimals[5] = {0}; + char characters[5] = {'0','0','0','0','0'}; + bool booleans[5] = {0}; ``` === "Python" From f90f15c77de07f69c938f1c170aba3e042f2390e Mon Sep 17 00:00:00 2001 From: Yudong Jin Date: Sat, 24 Dec 2022 22:21:17 +0800 Subject: [PATCH 2/2] Update data_and_memory.md --- docs/chapter_data_structure/data_and_memory.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/chapter_data_structure/data_and_memory.md b/docs/chapter_data_structure/data_and_memory.md index 5d492246..016419d9 100644 --- a/docs/chapter_data_structure/data_and_memory.md +++ b/docs/chapter_data_structure/data_and_memory.md @@ -58,10 +58,10 @@ comments: true ```cpp title="" /* 使用多种「基本数据类型」来初始化「数组」 */ - int numbers[5] = {0}; - float decimals[5] = {0}; - char characters[5] = {'0','0','0','0','0'}; - bool booleans[5] = {0}; + int numbers[5]; + float decimals[5]; + char characters[5]; + bool booleans[5]; ``` === "Python"