Arrays as function parameters
Hi,
I'm new to this forum and fairly new to C++ programming. I was working on a program today when I got stuck on something and I'm wondering if someone could help me out.
Ok, so I'm wondering if it's possible to use a array name as a parameter in a function that I can plug different arrays in (with the same dimensions). These are the basics of how my program went (with unimportant stuff left out):
void check_flags(int moves[], int flags[], int win_lose);
int main()
{
int winflags[3][7];
int loseflags[3][7];
int moves[7];
int win_lose = 1;
check_flags(moves, winflags, win_lose);
int win_lose = 2;
check_flags(moves, loseflags, win_lose);
}
void check_flags(int moves[], int flags[], int win_lose)
{
//do some stuff here using flags[] (but have it stand for either winflags[] or loseflags[])
}
I hope this explains my problem well enough... In this situation I want to substitute the 2 different arrays (winflags and loseflags) into parameter 2 of the function. I guess I could write two different functions, one for each, but I was wondering if there was a way this could be done.
Thanks