fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. void print_vec(int arr[])
  5. {
  6. std::vector<int> vec;
  7. vec.insert(vec.begin(), arr, arr+3);
  8. for (auto x: vec) {
  9. std::cout << ' ' << x;
  10. }
  11. std::cout << '\n';
  12. }
  13.  
  14. int main ()
  15. {
  16. int arr[] = { 501,502,503 };
  17. print_vec(arr);
  18. }
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
 501 502 503