I don't believe that will work. The array that you declare within makeArray() is stored in the stack frame. Once the function returns that stack frame is no longer valid, so the pointer you return will not be pointing to anything meaningful.
I think a better approach is to pass a pointer (or a pointer to a pointer, or whatever you require) as an input parameter to the function and then manipulate that pointer within the function. Be very careful about memory allocation to ensure that it is still valid when you exit the function.
I'd prefer to create the array outside the function rather than within it. That way it's easier to keep track of the size of the array. If you create the array within the function I think it would be good practice to also return a paramater containing the size of the array created.
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this
site. Computing.Net and Compnet Ventures, LLC hereby disclaim all responsibility
and liability for the content of Computing.Net and its accuracy.