First: Like toum said - don't pass-by-value. When you do that, a copy of the variable is created. That copy is deleted when the function ends, so "initilize" actually does nothing. If you want the object to be changed, sent it as a pointer, but notice that the syntax changes as a result! Like toum said, now it's "h->t[j]" and not "h.t[j]".(that's just in case you didn't cover pointers yet..) You can avoid that by passing h as reference:
void initilize(ComplexHotel &h) {}
With the "&" prefix, you can now treat it like a normal variable, and changing it will actually change the original variable.
Second: "nroomempty" is an array. An array is a pointer to the first variable in the sequence. Setting it as 0 will ruin the pointer and leak memory. In your case its impossible because you have't dynamically allocated the array (if you don't know what that means, just gloss over that.)
If what you want to do is set each individual variable in the array to 0, the way to do that, like toum pointed out, is to make a loop which goes over all the array:
1 2 3 4 5
|
for (int j=0;j<MAX_HOTELS;j++){
for (int i=0;i< MAX_DAYS;i++){
h->t[j].nroomempty[i]=0;
}
}
|
Same way you made a loop which goes over all the "TableH" array.
Hope it helps :)_