0
Can someone please help me with this error? It shows an "invalid types 'char[int]' for array subscript" error.
// sets the student's gender with the char passed in void Student::setGender (char Gender) { for(int c = 0; c < 1; c++){ // we use t < 1 because Gender holds a one-character value gender_[c] = Gender[c]; } } // returns the student's gender string Student::getGender (void) { return gender_; }
2 ответов
+ 8
Hii Floyd Ack
So like in your gender[c], don’t do that!
Since you’re passing in a char already, you don’t have to do char[0]
Just do gender = Gender or something along those lines..
That might help!👍
+ 2
Thank you very much!