#include <iostream>

int main() {
    // 1. 初始化
    int a0[5];
    int a1[5] = {1, 2, 3};  // other element will be set as the default value
    // 2. 得到长度
    int size = sizeof(a1) / sizeof(*a1);
    cout << "The size of a1 is: " << size << endl;
    // 3. Access Element
    cout << "The first element is: " << a1[0] << endl;
    // 4. 遍历
    cout << "[Version 1] The contents of a1 are:";
    for (int i = 0; i < size; ++i) {
        cout << " " << a1[i];
    }
    cout << endl;
    cout << "[Version 2] The contents of a1 are:";
    for (int& item: a1) {
        cout << " " << item;
    }
    cout << endl;
    // 5. 修改
    a1[0] = 4;
    // 6. 排序
    sort(a1, a1 + size);
}