fork download
  1. #include <cstdint>
  2. #include <iostream>
  3.  
  4. template <class T, size_t N>
  5. void print_array(T (&arr)[N]) {
  6. for (T &i : arr) {
  7. std::cout << i << '\n';
  8. }
  9. }
  10.  
  11. int main() {
  12. int arr[] = { 1,2,3,4 };
  13. print_array(arr);
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
1
2
3
4