So I created a dynamically allocated array of structs pretend that structtype is the name of the struct, and arr is the array.
structtype * arr; arr = new structtype[counter+15]; Then I attempted to pass that array of structs into multiple types of functions with prototypes such as:
void read_info(structtype (&arr)[15], int integer); and
void Append(structtype arr[15]); In turn I got these errors:
error: cannot convert ‘structtype’ to ‘structtype (&)[15]’ and
error: cannot convert ‘structtype**’ to ‘structtype (&)[15]' Can yall help me figure out how to get rid of these errors, for example dereferencing the pointer part of the array or something.
newgive you a pointer. It can't give you an array, because an array's size must be known at compile time. You need to change your function signatures to take a pointer. But really, you should just usestd::vectorinstead.std::arrayorstd::vectorinstead and usestd::spanif you want your function to be flexible in what it takes as argument.