Specifically, if I am passing a numeric argument to a function, what happens if I change it within the function?
Code: Select all
function foo(int x) {
x--;
// do some more stuff here
}
int n=5;
foo(n);
// all right, what is the value of n now?
Moderators: adafruit_support_bill, adafruit
Code: Select all
function foo(int x) {
x--;
// do some more stuff here
}
int n=5;
foo(n);
// all right, what is the value of n now?
Code: Select all
void foo(int a[]){
a[0] = 1;
}
void loop(){
...
int b[10];
b[0] = 0;
foo(b);
// b[0] is 1
}
Code: Select all
void foo (int& bar);