I have defined a Struct:
struct sym{
int data_onel;
int data_two;
}
and I have function:
sym*& fillStruct(){
sym array_of_struct[size];
/.. fill array with data
return *array_of_struct;
}
Where I create an array of struct and fill structs with data. However I would like to return this arr in another function. e.g
bool another(){
sym *next_array = fillStruct();
}
I want it to pass by reference so it won't get destroyed, but it keep throwing:
invalid initialization of reference of type 'Symbols*&' from expression of type 'Symbols'
How can I return array of structs from function then? with reference.