Thanks kbw.
I'm currently getting these errors for the first function. I'm also getting errors for the second function as well but I won't post those because that function is very incomplete.
flightUtil.cpp: In function 'int searchFlights(int*, Flight*, int, const std::st ring&, const std::string&)':
flightUtil.cpp:93: error: request for member 'set_orig' in '*(((int*)(((long uns igned int)j) * 4ul)) + flightIdx)', which is of non-class type 'int'
flightUtil.cpp:94: error: request for member 'set_dest' in '*(((int*)(((long uns igned int)j) * 4ul)) + flightIdx)', which is of non-class type 'int'
The first function is searching the list of all flights (flights) for those that match orig and dest and place the results in something that you've called flightIdx, which you've declared to be an array of ints.
We'll it may be more helpful if you called it matchedFlights, but more importantly, it's an array of flights.
You have the assignment the wrong way arround.
And finally, a design error. You don't tell the called how many flights actually matched and were placed in the first parameter. As you're not using the return value, you could return that value from the function.
Thanks kbw, that was helpful. I didn't write the function definition so it's supposed to be an array of ints, I guess. I think the comment could of definitely been clearer.
In which case, maybe flightsJdx has the indices where a match is found. It's impossible to tell without more information. Seeing how the function is meant to be used might settle the question of the specification.
Kbw, are you saying your modifications were right?
Thanks
Edit: I think I'm beginning to understand it more. The way I see it, if the 'orig' and 'dest' match, then the index of the location in the array will be stored in flightIdx.