When should you use pointers in programming? What do pointers allow you to do? Pointers allow you to pass only an address, instead of all of the data. Pointers also allow you to MODIFY (mutate) the data stored at that address. So if you don't want to pass all of the data, or if you want to change the data stored at a memory address, then use a pointer.
Pointers allow you to share a value stored in some memory location. Use pointers when
you don’t want to pass around a lot of data
you want to change the data at a location
Everything in Go is pass by value. Drop any phrases and concepts you may have from other languages. Pass by reference, pass by copy - forget those phrases. “Pass by value.” That is the only phrase you need to know and remember. That is the only phrase you should use. Pass by value. Everything in Go is pass by value. In Go, what you see is what you get (wysiwyg). Look at what is happening. That is what you get.
code:
step 1 no pointer:
step 2 pointer:
JOIN ME, CONNECT, & FOLLOW
YOUTUBE PERSONAL
EQUIPMENT:
0 Comments