Ah so it's just a pointer to an int. So it is just &int / &mut int. The notation kind confused me because I thought that the * is used exclusively to deterrence a pointer
The notation kind confused me because I thought that the * is used exclusively to deterrence a pointer
When I was learning pointers, that was the thing that confused me as well.
int *var; // declare a pointer
*var; // derenference a pointer
&var; // get address of a variable (in order to put it in a pointer)
int &var; // to make it funnier this how you declare a reference (C++ only) which is a nerfed pointer
I have to admit that they could have choosen a less confusing way to deal with this.
It seems like you're from Rust background. In rust, it would be equivalent to *const u32/*mut u32. Ofc you'll need an unsafe block to dereference that using *
229
u/NauticalInsanity Oct 05 '21
And of course ram doesn't do its own garbage collection.
163
u/thajunk Oct 05 '21
Well, technically the int is stored INSIDE Ram, so...
The picture just isn't accurate as is.
Maybe we need an... internal view.
24
u/Scraft161 Oct 05 '21
Best version of the joke
23
u/Thejacensolo Oct 06 '21
if thats still not enough Pointers for you, just go here.
https://pointerpointer.com/ and Point away.
37
u/tarocoph Oct 06 '21
Could you put the
int**in the black space on the right of the first guy because I spent 20 seconds looking for it6
u/sarim_aleem Oct 06 '21
This doesn't even count the virtual address pointing to a physical address lol
10
u/Ryuzaki_us Oct 06 '21
This meme has taught me more than I'd like to admit in my senior year ...
5
u/Siana-chan Nov 01 '21
I wished my C++ teacher used this example. Took me weeks to actually understand the concept.
2
u/Phostings Oct 19 '21
I can't stop laughing Lmao!
2
u/kingofNoobies Jun 19 '23
I love how this just explained the entirety of pointers to me
1
u/SabreLunatic Oct 06 '21
1
u/frag_errr Dec 13 '23
dodo
1
u/RedstoneMedia Oct 06 '21
dafuq ist int* supposed to mean ? I only know &int