📜  array copx c++ 代码示例

📅  最后修改于: 2022-03-11 14:44:54.749000             🧑  作者: Mango

代码示例1
#include  //Only needed for Option 1
#include 

using namespace std;

int main() {
      //Option 1
    const int len{3};
    int arr1[len] = {1,2,3};
    int arr2[len]; //Will be the copy of arr1
    copy(begin(arr1), end(arr1), begin(arr2));
  
      //Use the following, if you are not using namespace std;
    //std::copy(std::begin(arr), std::end(arr), std::begin(copy));
  
    //Option 2
    int arr3[len]; //Will be the copy of arr1
    for(int i = 0; i