运行 ❯
获取您
自己的
网站
×
更改方向
更改主题,深色/浅色
转至 Spaces
#include <iostream> #include <cstring> using namespace std; int main() { int myNumbers[6] = {10, 20, 30, 40, 50, 60}; cout << "Before:\n"; for (int i = 0; i < 6; i++) { cout << myNumbers[i] << " "; } memmove(&myNumbers[0], &myNumbers[2], 4*sizeof(myNumbers[0])); cout << "\nAfter:\n"; for (int i = 0; i < 6; i++) { cout << myNumbers[i] << " "; } return 0; }
之前
10 20 30 40 50 60
之后
30 40 50 60 50 60