problem with making function

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
void read_player1_hand(ifstream& in_stream, string& card_value[],string& card_suit[],int max_length)
{
     char next_char;
     while(!in_stream.eof())
     {
          int i=0;
          card_value[max_length];
          card_suit[max_length];                  
          in_stream.get(next_char);
          if (is_card_value(next_char))
          {
              card_value[i]+=(string(1,next_char));
          }
          else if (is_card_suit(next_char))
          {
              card_suit[i]=(string(1,next_char));
          }
          i++;
     }
}


the problem I'm having is that it's just says declaring an array of references when refering to the function header. After that it also tells me that card suit and card value are undeclared, but if I declare them inside the function it tells me I am shadowing a parameter.

Am I missing something in the function header?
string& card_value[]
This is illegal. You can't make arrays of references.
so how could i pass out two arrays of strings?
for instance I want the card_value and card_suit passed out of this function to be used in others.
If card_value and card_suit are string arrays just remove the &.
That would be
string card_value[]
No ampersand. This actually just passes a pointer to an array of strings.
okay i haven't learned about pointers yet.
thanks
as long as I just put sting card_value[] , inside the function header, it will change the value of the string outside kind of like call by referce?
just making sure i understand.
Yes, that's correct.
thanks again
Topic archived. No new replies allowed.