An array cannot be a function argument.
Furthermore, an int reference cannot bind to an array of int. Nor could an integer reference be used as an array.
However, a pointer can be accessed with a subscript operator in much the same way as an array can. The name of the array actually implicitly converts to the pointer to first element. This conversion is called decaying:
int array[n];
int* ptr_to_first_element = array;
assert(ptr_to_first_element[i] == array[i]);
So, you can use an integer pointer as a function argument, and pass a pointer to the first element of an array:
void foo(int *array, std::size_t size);
// ...
int array[n];
foo(array, n);
All of the above applies to lambdas as well. So you could write:
auto print_array = [](int *array, int i) -> int {
// ^ notice this
//print out array using the pointer
return 0;
}(&actual_array, actual_i);
You can however have a reference-to-array-of-certain-size as an argument to a function:
void foo(int (&array)[20]);
This is a bit limiting, since the reference can only bind to an array of one particular size. A template makes it simple to generate such function for any size of array:
template<std::size_t size>
void foo(int (&array)[size]);
Polymorphic lambdas (introduced in C++14) simplify this greatly:
int actual_array[10];
auto print_array = [](auto &array, int i) -> int {
// ^^^^^^ notice this
//print out the referred array
return 0;
}(&actual_array, actual_i);
In this case, the type of array argument would be deduced to be int (&)[10].
P.S. "print out" the array sounds like something that doesn't need to modify the array. Consider this and if possible, use a const pointer to first element or const reference as the argument.
Note that the std::array wrapper is a class, not an array. As such, std::wrapper does not implicitly decay to pointer, and std::array can be used as a function argument if so is desired.
int& arrayis a reference to an integer, not anything that resembles an array.