I know how to pass a complete multidimension array to a function, but how can I pass one element only of a multifunction array to a function? how will the actual parameter list and former parameter list look like?
The function doesn't care that the argument is part of an array. Just write the function to accept an argument of whatever type the elements are.
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
void print(int value)
{
std::cout << value << "\n";
}
int main()
{
int arr[] = {2, 5, 9};
print(arr[1]); // passes an element of the array `arr` as argument to the function `print`
}