Copyright ©2004 Pearson Addison-Wesley. All rights reserved.
Returning an Array from a function(2)
Type problem between int and int*
a is a constant pointer type, you can’t change it.
Array c is stored in function foo’s stack frame.
Return just copies the pointer, not the array.
Memory where the array c resides may be overwritten once function foo finishes its execution.
To do it properly
Pass an array as a function argument from your calling function and modify it inside the called function.