Start learning the C language pointer

Source: Internet
Author: User

Pointers and Array representations

int a[10]={1,2,3,4,5,6,7,8,9,10};

int *p;

Among them p=&a[3];  Many books only write p=&a[0];. It is possible to find p=&a[n] through practice.

The array name A is an address that is the address of the No. 0 element of the a array equivalent to &a[0]

If p=&a[0];  P, A and &a[0] three are equivalent; P+2, a+2, &a[0+2] equivalent;

* (p+2), a[2], * (a+2) values are 3 can also be used with the pointer + the underlying representation method such as: P[2] Its value is also 3

Pointer p and array name a plus subscript, and offset can be

The subscript is the element that represents the

add an offset or an address, To access the contents of the address to add *

Note: The pointer p is a variable and the array name A is fixed and cannot be assigned, and the self-adding arithmetic

Start learning the C language pointer

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.