If I have a struct with an array in it included in my main and I use a function to read data into that array how do I retain that data after I leave the function and return to the main?
Is this a case where I have to make the function string instead of void and return the array?
If it is, do I have to move the array from my struct and declare it elsewhere?
Arrays are passed as pointers, so you will be modifying original array. However:
Line 18: You should do cout << MyBooks.heading[4];
Line 13: This is one of the ugliest things C++ can do: function declarations inside functions.
Either move it before main() as forward declaration, or delete it and move getHeadings definition before main().