First of all, I think you should use std::string
for both name
and surname
, and also use std::array
for the Abbo
array:
struct RecAbbo {
std::string name;
std::string surname;
int games;
int won;
int same;
int lost;
int place;
int money;
};
std::array<RecAbbo, 100> Abbo;
you can declare a function func
that accepts a RecAbbo
by reference or by const
reference:
void func(RecAbbo&);
void func(RecAbbo const&);
The latter is recommended if you are not planning on modifying the struct
.
If you want to pass the array, you can use:
void func(std::array<RecAbbo, 100>&);
void func(std::array<RecAbbo, 100> const&);
or generalize it with iterators:
template<class It>
void func(It begin, It end);
or with templates:
template<std::size_t Size>
void func(std::array<RecAbbo, Size>&);
template<std::size_t Size>
void func(std::array<RecAbbo, Size> const&);