Pointer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Pointer

Explain to me pointers in a nutshell (/Friendliest way to understand)

5th May 2017, 4:51 AM
Complex
Complex - avatar
4 Answers
+ 10
pointer: points to variables place in memory. there are two parts to pointers. & - address-of operator : gets memory address * - Dereference operator : accesses the variable the pointer 'points' too int var = 5 ptr = &var // puts the memory address of var in ptr value = *ptr // puts the value pointed to by ptr into value.. (5) not the clearest. by i hope it helps 😊
5th May 2017, 5:07 AM
jay
jay - avatar
+ 8
Oh now I get it, Thanks @jay :D Its like reading someones memory and trying to copy what he's doing! :D Awwwsumm
5th May 2017, 5:09 AM
Complex
Complex - avatar
+ 7
@jay Now thats a very cool thing to do Thank you very much, helped alot to learn pointers as it is important in Rust
5th May 2017, 5:13 AM
Complex
Complex - avatar
+ 6
You can also edit what the person is thinking *ptr = 6 would change var from 5 to 6
5th May 2017, 5:12 AM
jay
jay - avatar