Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,959 questions

51,901 answers

573 users

How to use pointer to pointe (**) in Golang

1 Answer

0 votes
package main
 
import "fmt"
 
func main() {
    var n int
    var p *int
    var pp **int
 
    n = 99
    p = &n
    pp = &p
     
    fmt.Println("n:", n)
    fmt.Println("p:", p)
    fmt.Println("pp:", pp)

    fmt.Println("\n")
    fmt.Println("&n:", &n)
    fmt.Println("&p:", &p)
    fmt.Println("&pp:", &pp)
 
    fmt.Println("\n")
    fmt.Println("*p:", *p) 
    fmt.Println("*pp:", *pp)
    fmt.Println("**pp:", **pp)
}




/*
run:

n: 99
p: 0xc000092010
pp: 0xc000094018


&n: 0xc000092010
&p: 0xc000094018
&pp: 0xc000094020


*p: 99
*pp: 0xc000092010
**pp: 99

*/

 



answered Aug 26, 2020 by avibootz

Related questions

2 answers 219 views
219 views asked Aug 25, 2020 by avibootz
1 answer 183 views
3 answers 210 views
210 views asked Aug 15, 2020 by avibootz
1 answer 158 views
158 views asked Mar 7, 2020 by avibootz
1 answer 162 views
162 views asked Aug 15, 2020 by avibootz
3 answers 245 views
...