Finding size of passed array

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.

Thanks,
That's a different type of array. I'm typing on a phone, so it's hard to give a good reply now. Someone will pick up here.


And since we're here, you might want to check out maps too:
http://www.cplusplus.com/reference/map/
Topic archived. No new replies allowed.