Can someone help me understand the difference between &knuckles and *knuckles? I'm new to c++
@Bl4ckb0ne
(I know about the operators, this was mostly about the meme, still, I'm confused about the difference between
`void foo(int &bar)`
And
`void foo(int *bar)`
@pounce First one passes `bar` as a reference, second one passes it as a pointer
@Bl4ckb0ne
What's the difference?
@pounce I think @Bl4ckb0ne is pointing to it :^)
@pounce A reference is a const, non-nullable and non-copyable pointer https://stackoverflow.com/questions/57483/what-are-the-differences-between-a-pointer-variable-and-a-reference-variable-in
@Bl4ckb0ne
Thank you ❤️
@pounce Well, my first advice would be "use a good programming language".
If knuckles is a pointer, &knuckels lets you know where the pointer knuckles is stored (so you can add another pointer to it) and *knuckles lets you access the thing knuckles is pointing on.
If it's not a pointer, *knuckles might be wrong (unless you declare it as a pointer).
@pounce `&` is for getting a pointer, as `*` is for dereferencing your pointer (accessing the pointed value)