/* COMP2401/2001 - W13 mjh - 2013 */ #include // function that takes memory addresses as input int add1int(int* x){ // x is a local variable to the function. // its value is the memory location of the argument // passed to it. It is a memory location (pointer) // let's grab the value that x points to int local_int = *x; return local_int + 1; // could have, more compactly, had // return *x + 1; or // return (*x) + 1; // Note: this is very different from // return *(x + 1) } // this function lools like it takes an array as input. // but, remember that an array is just a pointer! // so, the input is really a pointer to a char. thus, // whenever we pass an array into a function, we never // make a copy of the array, we just pass the location of // the array. int* add1(int x[], int n){ for(int i=0; i