数组的插入

#include <iostream>
using namespace std;
int main(void) {
    char arr[5] = {'a','b','c','d','e'};
    char arr1[6];
    for(int i = 0;i<2;i++){
        arr1[i] = arr[i];
    }
    for(int i = 4;i>=2;i--){
        arr1[i+1] = arr[i];
    }
    arr1[2] = 'm';
    for(int i = 0;i<6;i++){
        cout << arr1[i] << ' ';
    }
}
#include <iostream>
using namespace std;
int main(void) {
    char arr[5] = {'a','b','c','d','e'};
    //删除第二个元素a[1]
    for(int i = 1;i<4;i++){
        arr[i] = arr[i+1];
    }
    arr[4] = '\0';
    for(int i = 0;i<5;i++){
        cout << arr[i] << ' ';
    }
}