I needs c++ help
I need to return 3 values (1 int, 2 strings) from a function, one of which is being returned direct by the return function (the int). So i'm employing a struct for the final 2.
I can pull the values from the struct back within the same function, but I can't pull them back in other functions, it just returns blank.
I have a struct in a header file, populated by one function via an object i.e.
int function1()
{
structname structObj
structObj.firstval = value
structObj.secondval = value2
}
int function2()
{
structname structObj
cout << structObj.firstval
cout << structObj.secondval
}
How do I pull the values out in function 2?
Pointers? How do I set the pointers up correctly for a struct? I'm guessing it's something easy that i'm missing but I just can't see the wood for the trees right now