C-language function pointer array (good to go around)

Source: Internet
Author: User

int * (*p (int))) [3]

Someone asked me what this is today. I look directly at the crazy force ...

Let's do some simple analysis below.

int p; This is the integer variable p

int *p; This is the integer pointer p

int *p[3]; This is an integer pointer array of length 3 p, the element is an integer type pointer

int (*p) [3]; This is an array pointer pointing to an array of integers of length 3

int p (int); This is the function declaration , parameter: integer type, return value: integer type

equal to int p (int x);

int *p (int); This is the function declaration , formal parameter: integer type, return value: integer pointer

equivalent to int *p (int x);

Int (*p) (int); This is a function pointer to a function that has an integer type parameter and an integer type return value.

Int (*p[3]) (int);//This is an array of function pointers , each of which points to a function that has an integer type parameter and an integer type return value

int * (*p (int)); This is a function declaration , parameter: integer, return value: Pointer to integer pointer

equivalent to int **p (int), int **p (int x), int * (*p (int x))

int * (*p (int))) [3]; This is a function declaration , formal parameter: integer type, return value: An array of pointer arrays, pointers within this array, pointing to an array of integer pointers of length 3.

I know this is very round, simply say the return value is this: int *i[x][3]; X is any number

All the above conclusions are tested in VisualStudio2010 and are correct. If I have an omission, or there is nothing to express, please leave a message, Oh, da (づ ̄3 ̄) old.

C-language function pointer array (good to go around)

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.