View Single Post
May 11th, 2004
0

Return Array from C++

Expand Post »
Hi all,
Could anyone help me about returning the array from a function? I believe that it is a syntax error (compile time error) to return an array from a function, but one book mentions briefly that using pointer will solve the issue.
However, my current knowledge does not allow me to see how the pointer can solve this C++ limitation (return a pointer might be dangerous because it might point to the address of local variable, and this variable will go out of scope. Hence, this pointer will point to invalid value). I appreciate for your information.
Reputation Points: 21
Solved Threads: 0
Newbie Poster
tlee is offline Offline
15 posts
since May 2004