Apologies if this is a stupid question, but I'm a newbie and couldn't find the answer anywhere. I've declared an array of five objects (Fraction objects) like so:
Fraction *fractArray[5];
I'd now like to pass this array (or a pointer to it, at least) to a C-style function that will do various things to the fractions in the array and return a single fraction. After declaring a pointer to the array (call it *fractPointer) I've tried to set up a function like:
Fraction* arraySum (Fraction *fractPointer, int arraySize)
{
// dostuff , then return a fraction as the result
}
...and pass it the pre-defined pointer and the array size. I've established through debugging that the fractPointer successfully points at the first array element. The pointer is also pointing to the right place initially in the function. But I can't seem to get the pointer to increment to the next object in the array. It keeps throwing up errors when I do fractPointer++; (same thing when declaring a new Fraction pointer within the function). The complaint is that I'm doing arithmetic on a pointer to Fraction, which is not of a constant size. Am I going about this all wrong?