[ create a new paste ] login | about

Link: http://codepad.org/ZUWF8CP4    [ raw code | output | fork ]

C++, pasted on Jan 11:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <cstddef>
#include <cstdlib>
#include <iostream>

using namespace std;

template <size_t n>
void foo(int (&ar)[n])
{
   size_t i;
   for (i = 0; i < n; ++i)
      cout << ar[i] << endl;
}

int main()
{
   int my_arr[] = {7, -18, 0, 3};
   foo(my_arr);
   return EXIT_SUCCESS;
}


Output:
1
2
3
4
7
-18
0
3


Create a new paste based on this one


Comments: