C-Xiaoyi-pointer

Source: Internet
Author: User

Pointers are a type of data widely used in C language. They can be used to compile a refined and efficient program, which is also powerful and attractive.

I. pointer Declaration

Int (* func) (int * p, int (* f) (int *));

Int (* func [5]) (int * p );


Int (* func) [5]) (int * p );

* Func is a pointer at this time. A [] operator number on the right indicates that func is a pointer to an array. The elements of this array are pointers to functions, the Pointer Points to a function that has an int * type parameter and returns an int type.

 

Int (* func) (int * p) [5];

 

Func is a function pointer. This type of function has an int * type parameter. The returned value is a pointer to an array, and the elements to the array are arrays with five int elements.

 

Ii. pointer operation

 

Pointer operations are address operations. Therefore, only a limited number of operations are allowed. Generally, they point to a certain storage unit. addition and subtraction of pointers and integers are used to move pointers, the two pointers subtract to get the number of data between the two addresses. The comparison between the pointer and the pointer or the pointer and the address determines the sequence of the storage location pointed to by the pointer. During pointer operation, note that the data type referred to by the pointer is very important.

 

After understanding the pointer statements and pointer operations, the next article will make a difference and demonstration on specific pointer usage.

 

 

Related Article

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.