I need to find the size of an array that is passed into a function. http://www.cplusplus.com/reference/array/array/size/ shows the member function that should be used, however when I try to use it, I get out of scope errors, and invalid function errors.
1 2 3 4 5 6 7 8
void encounter::setInits (character ary[]) {
for ( int i = 0; i < ary.size() ; i++) {
int in;
cout << "What is " << ary[i].getname() << "'s initiative?: ";
cin >> in;
ary[i].set_init(in);
}
}
main.cpp|206|error: request for member 'size' in 'ary', which is of pointer type 'character*' (maybe you meant to use '->' ?)|
Any help in understanding why it is not working would be great.