Which of the following please?
I understand that a pointer is an address of something of a specific type.
So, int i = 18 , a pointer to it int *pI = &i;
The following 2 listings are available
void foo (int &something)
When we declare a function as
void bar (int *something)
Better send a pointer to something. Indeed, foo(pI) works.
Following the same logic, looking at
void foo (int &something)
We need to send him the address of what points to int as an argument, and then:
Why is foo(&i) wrong?
source share