|
|
int &b
. Is that the same as int *b
?capei wrote: |
---|
I'm a bit confused with the function's parameter int &b. Is that the same as int *b? |
int &b
) is another name for an existing variable. Here is a attempt to draw the function call (foo(x,y,z,p);
)as a diagram: Function | Main Scope | Scope | A +-----+ | X +-----+ | 5 | | | 5 |<-+<-+ +-----+ | +-----+ | | | | | B --+ | Y +-----+ | | +------|---->| 10 | | | | +-----+ | | | | | C +-----+ | Z +-----+ | | | 3 | | | 3 | | | +-----+ | +-----+ | | | | | D +-----+ | P +-----+ | | | @--|--|-+ | @--|--+ | +-----+ | | +-----+ | | +---------------+ | | |