How do you declare a pointer variable in Go?

  • int *ptr
  • ptr *int
  • ptr int
  • var ptr *int
In Go, you declare a pointer variable using the syntax var ptr *int, where ptr is the name of the pointer variable and int is the type it points to. This syntax indicates that ptr is a pointer to an integer type.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *