C Language Omission carding

Source: Internet
Author: User
Tags modifier

2017-06-10

The flexibility of pointers in C language correctly recognizes the combination of array function const and pointers.

(a) The special arrangement of other types of pointers is as follows:

The method of interpretation is as follows: int A; type descriptor variable name;

But for pointers the difference is that there are two ways to interpret the pointer, you can say that the pointer is the wall grass, both sides pour. The specific use is as follows;

int * A;

Interpretation method A type specifier variable name; in this case, int * is the type character a is a variable.

But this way can make people misunderstand, apply multivariate int A, b, C;  But the user will write this idea as an int * A,B,C; So this is wrong, so the user should pay attention to the disconnection method is int *a, the * near the variable can be broken . But the meaning of interpretation is still the type specifier variable name, at this time the user application habit is int *a,*b,*c;

Interpretation method Two 1 pointer Unit 2 pointer symbol 3 variable; int * A;

21 Pointers 3a points to 1 pointer Unit int;

The way of reading three wall grass

reference int A; We think of the variable array function structure with such examples as: type specifier variable name; (except for variables are type specifiers). at the same time, two ways to interpret the pointer ;

The relationship between the following special-case pointers array functions is explained in the above two ways;

A. int * A[3];  Array char * Test (A, b); Function

B. Int (*a) [3]; Pointer char (* test) (A, B), pointer

The pointer is the wall grass

In the case where it is left-to-right, it is an int * char * that is the same data type as int.

Group B because of the wall (parenthesis) pointer backward to this side of the variable is a pointer to the type int [3]; Point to Type char (A, b);

With respect to assignment, pointer a assigns an object of type int "3" to a pointer such as int B "3" a=&b;

The function name has an address attribute as the name of the array, so the test= function name does not need to fetch the address character;

But the virtual address of the ego needs to be in the process of assignment: the name of the test= (&) function; here's the & it's hypothetical, so it's easier to understand the execution of subsequent functions, and it's just handy to understand and not really mean.

(b) The interpretation of the modifier variable is also split into the type specifier variable name;

such as: int const A;

const int A;

const INT * A; Pointer interpretation mode 21 pointer A to the const modifier int data, that is, the object pointed to by the pointer is const decorated, further is unable to modify the data through the pointer;

int * const A; Interprets a pointer a,a by a const modifier, pointing to the int type;

Name definition

function pointers

Const

C Language Omission carding

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.