What's the difference between:
int i = 0;
foo(i);
int foo(int i){
...
}
and:
int i = 0;
foo(&i);
int foo(int *iPtr){
...
}
I mean, is passing by reference faster and better for memory/performance? Why should I use reference?
Also, my professor said that when we pass by value we are actually passing for reference.. so what's the real difference between them?
I thought that pointers and passing by reference were used to optimize performance and memory..