Possible Duplicate:
Returning local data from functions in C and C++ via pointer
I need to create a function with no arguments that returns an array
I get the error: "warning: function returns address of local variable"
my code has been simplified for ease of reading
int * getNums()
{
int nums[8];
nums = {1,2,3,4,5,6,7,8};
return nums;
}
I am led understand that when the function ends the pointer is lost, but will the array still be sent? If not, what is a good way to return this integer array with no arguments in the function call?
Appreciate the help in advance!
Cheers