The declaration of the Golang pointer exactly matches my expectations.

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.

The declaration of the Golang pointer is very clear and unambiguous.

var i int: Declares an ordinary variable of type int . You can read this: A variable is declared i , and the type is int . (Note: Golang put the variable type behind the variable name)

var ip *int: Declares a pointer variable of type *int (why not put it * on the right?). May be afraid to confuse multiplication sign and pointers). The pointer variable stores the memory address (equivalent to the index of the byte array), and the corresponding content on the memory address is the int type.

var array [3]int: The declaration of an array variable array of type [3]int (the length of the array is 3, and the element of the array is the int type).

var arrayp [3]*int: The declaration of the pointer array variable arrayp , type [3]*int (array length is 3, array element is *int type).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.