Function returning array

How to write a function that passes an array of n pointers to floats and returns a newly created array that contains those n float values.

"newly created array" implies that you have to allocate memory dynamically. You can refer to dynamically allocated memory only with a pointer, and you have to explicitly take care of deallocation.

An array argument to a function decays to pointer.

If the input has N values, then the output should have N values too.

You surely know what to do here?
1
2
3
4
5
6
int foo = 42;

int * bar = &foo;
int gaz;

// How to copy the integer value pointed to by bar into gaz? 
Topic archived. No new replies allowed.