Quote Originally Posted by Geordienev View Post
Cheers for the replies guys, I'll be the first to admit that my coding is absolute shiet to read lol.
But with the struct, do you declare that at the start of the code or within the fucntion? and how exactly do you use it.
Do you replace the;
Code:
return (itemId, itemPrice, discountType, quantity, recordNum);
Or does it sit somewhere else, I can understand why its simpler to use and i thank you for that.
I'll also give it a go at debugging now.
Using a struct is one way. You'd create the struct and return it. In your case, it's not really necessary as you're passing in the parameters by reference. That means that when you set the values of the parameters in the function, they'll contain the values in the calling function when the called function returns. For example

Code:
void somefunction(int& i)
{
    i = 1;
}

int main()
{
    int nInt = 0;
    somefunction(nInt);
    //nInt = 1 now.
}
Setting up parameters like that are called output parameters. That's typically how you get a function to populate multiple variables.