C language pointer and accessors

Source: Internet
Author: User

 

Int array [10];

Int * P; // three equivalent representations

P = & array [0];

 

Or

Int * P = & array [0];

 

Or

Int * P = array;

 

It should be noted that learning C language is to learn how the C language compiler interprets C statements,

In addition, how to explain each sentence is not to combine the interpretation of one symbol and then constitute the interpretation of the entire sentence.

For example, int * P = & array [0];

In this case, the compiler defines a pointer P, and the pointer P points to the first address of the array,

Instead of defining a pointer P, P points to the address with the same content as the first data in the array.

* P = array [0]; indicates that the content pointed to by the P pointer is the same as the first data in the array.

There aren't many theoretical reasons to explain. Just remember.

There are many other definitions like this. All of them need to be remembered one by one, and then understand the meaning, and gradually master the C language.

 

 

 

 

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.