🔒 Closed [go] pointer and dereference

Status
Not open for further replies.

Katipunero-

Honorary Poster
Para din sa mga nalilito, share ko tong ginawa kong simple explanation para magets yung logic and usage nila.

Code:
package main

import "fmt"

func main() {
    name := "PHCorner" // Simpleng string variable.
    fmt.Println("string variable name:", name)
    p := &name // Nasa akin ang RAM address ni variable name.
    fmt.Println("RAM Address:", p)
    dp := *p // Hawak ko ang value ng owner ni Ram Address na hawak ni p.
    fmt.Println("Dereference Pointer:", dp)
}

Go playground: You do not have permission to view the full content of this post. Log in or register now.
 
Status
Not open for further replies.

Similar threads

About this Thread

  • 0
    Replies
  • 284
    Views
  • 1
    Participants
Last reply from:
Katipunero-

Trending Topics

Online now

Members online
965
Guests online
14,115
Total visitors
15,080

Forum statistics

Threads
2,366,407
Posts
29,434,809
Members
1,043,973
Latest member
ikoy
Back
Top