943,766 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 7936
  • C++ RSS
Oct 12th, 2005
0

returning arrays from functions

Expand Post »
Is it right to say that....since arrays are passed by address automatically...so there's no need and reason to return arrays from functions(Is that the reason why it is not allowed in c/c++)
SpS
Reputation Points: 70
Solved Threads: 32
Posting Pro
SpS is offline Offline
598 posts
since Aug 2005
Oct 12th, 2005
0

Re: returning arrays from functions

there is a need and a reason to return arrays and it can be done, you just return a pointer to its first address. If what you meant was an array return by value, i.e. a copy of the array then yes this never happens in c++. arrays are always treated as reference types.They are not copied into funcs or out of them.
Reputation Points: 19
Solved Threads: 5
Junior Poster
Stoned_coder is offline Offline
164 posts
since Jul 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Help w/ for loop.
Next Thread in C++ Forum Timeline: Using Cout or printf commands





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC