Skip to content

1-D arrays: store, index, and traverse · ⁨一维数组:存储、索引与遍历⁩

English

A row of boxes

  • An array is a row of variables of the same type, kept side by side in memory.
  • int a[5]; makes room for five ints. They are one block, reached by number.
  • You can fill them when you create them: int a[] = {10, 20, 30}; makes an array of three.
中文

一排盒子

  • 数组是一排同样类型的变量,在内存里挨着排放。
  • int a[5]; 为五个 int 腾出空间。它们是一整块,用编号来访问。
  • 你可以在创建时就填好:int a[] = {10, 20, 30}; 创建一个有三个元素的数组。

Handout

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩