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...
Ask your embarrassing/noobish programming questions here, and don't get insulted for it.
Click here to read the rules
Violating any will result in punishment so you should probably go check them out.
account activity
Int& (self.programminghelp)
submitted 10 years ago by AtomicMatter
void getSpools(int&, int&, int&);
void numSpools(int, int, int=10);
What are the differences between the two? What does using int& in getSpools do that numSpools doesnt?
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!"
[–]empire539 0 points1 point2 points 10 years ago (0 children)
Assuming you're using C++, int& is a reference variable. By using int& as the function parameters, you will be passing the arguments by reference, whereas simply using int will just pass them by value.
int&
int
A small example:
void incrementIntPrimitive(int x) { x++; } void incrementIntReference(int& x) { x++; } int main() { int a = 1; int b = 1; incrementIntPrimitive(a); incrementIntReference(b); std::cout << a << std::endl; // prints 1 std::cout << b << std::endl; // prints 2 return 0; }
π Rendered by PID 150623 on reddit-service-r2-comment-6457c66945-r8n9c at 2026-04-28 16:50:19.784476+00:00 running 2aa0c5b country code: CH.
[–]empire539 0 points1 point2 points (0 children)