+ 1
PassByValue
How do you do the pass by value question?
3 Answers
+ 3
Pass by value:
void value(int a) {
a += 5; // only changes a inside the function
}
By Reference:
void reference(int& a) {
a += 5; // changes the passed variable
}
int x = 10;
value(x);
// x is still 10
reference(x);
// x is now 15
+ 3
How should anyone know what you're even talking about?
+ 1
normally 'pass';
if(x==2) pass;
and finished...
Is that what you want to say?