fork download
  1. #include <iostream>
  2.  
  3. template<typename T>
  4. void print_arr(T *first, T *end)
  5. {
  6. if (first != end)
  7. {
  8. std::cout << *first << std::endl;
  9. print_arr(first + 1, end);
  10. }
  11. }
  12.  
  13. int main()
  14. {
  15. int arr[] = { 1, 2, 3, 4, 5 };
  16. print_arr(arr, arr + sizeof arr / sizeof *arr);
  17. }
Success #stdin #stdout 0.01s 2680KB
stdin
Standard input is empty
stdout
1
2
3
4
5