Is it possible to return an array from a library?

I would like to create a library that reads data (bytes) from a peripheral device and then returns that data as an array back to the main program. For example, the main program would call a library function, perhaps "foo(5)" that returns a 5 byte array that can be assigned to "bar[]".

The array is only 5 bytes. An alternative is to write five different functions: e.g., int getFoo0(), int getFoo1(), etc. using the "return(variable)" to return each piece of data back to the main program. Then write code to assemble each piece of data into an array: e.g., bar[0] = getFoo0(); bar[1] = getFoo1()

Anyone have thoughts or ideas on this. I did read a C++ posting that implied that this wasn't possible.

Create an array in main program, than call a library function foo( array, size ) passing array pointer as parameter. Function could be void or return a status error.
Declare a void foo( int * array, int size ) before first call.

Thanks, I'll give it a try.