C pointer and pointer

Source: Internet
Author: User

C pointer and pointer

# Include <stdio. h> int func (int a, int B) {return a + B;} int main (void) {int (* p) (int, int) = func; // The function name is the function entry address printf ("% d \ n", p (4, 4); return 0 ;}// int (* p) (int) can be seen as int A (int). This is A pointer to A function whose parameter is int and the return value is int. Function pointer. // Int * p (int) is a function. Its parameter is an integer, And the return value is a pointer to an integer. # Include <stdio. h> int * func (void) {return NULL;} int main (void) {int * p = func (); return 0 ;} // int ** p This is a pointer pointing to another pointer, which points to an integer and a second-level pointer. Int a, B; int * q = & a; p = & q; * p = & B; can be used to change the direction of a pointer # include <stdio. h> // This is still a function, pointing to the Array Function int (* func (void) [10] {return NULL;} int main (void) {int (* p) [10] = func (); return 0 ;}

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.