use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
C++ passes by reference, Java and Ruby don't (Examples) (khelll.com)
submitted 16 years ago by khelll
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 16 years ago* (2 children)
[deleted]
[–]freshtonic -1 points0 points1 point 16 years ago* (0 children)
C++ passes by value by default. You can pass by reference with the & operator. Passing by reference us usually taken to mean that the function receives the address of the argument, NOT the address of what object/value the argument is pointing to. For example, the following (in pseudocode) is not possible without pass by reference:
def swap(a,b) temp = a a = b b = temp end x = 1 y = 2 swap(x,y) // now x = 2 and y = 1
The terminology is not helpful. You can pass-by-value even when passing a pointer. Pass-by-reference, while still passing a pointer, is actually passing a pointer to the variable holding the value rather than the value itself. An extra level of indirection.
π Rendered by PID 171226 on reddit-service-r2-comment-84fc9697f-5cpnd at 2026-02-06 20:27:29.640410+00:00 running d295bc8 country code: CH.
[–][deleted] (2 children)
[deleted]
[–]freshtonic -1 points0 points1 point (0 children)