How to pass a structure to a function in C++