High-level statement (--C Primer, chapter 13th)

Source: Internet
Author: User

Advanced statement:

(1) int *f , G;

This only declares an F pointer. * are all immediately followed.

(2) int *f ();

F is a function whose return value is a pointer to an integral type.

(3) Int (*f) ();

F is a function pointer, and the return value of this function is an int type.

(4) int * (*F) ();

F is a function pointer, and the return value of this function is a int* type

(5) int f[];

F is an integer array, the length of the array is temporarily omitted

(6) int *f[]

F is an array whose elements are pointers to integral types

(7) int f () []--- this declaration is illegal

Here f is a function whose return value is an integer array, but this declaration is illegal

, since the function cannot return an array, only the scalar is returned.

(8) int f[] ()--- this statement is illegal.

Here f is an array in which the return value is a function of int, this declaration is illegal

Because each function does not have the same size, the elements of the array need the same size.

(9) Int (*f[]) ();

Here f is an array, and the elements of the array are pointers to functions, and the return values of these functions are

int type

(Ten) int * (*f[]) ();

Here f is an array, and the elements of the array are function pointers, and the return values of these functions are int* type

The front is old style.

Here's the new style.

Int (*f) (int,float);

Here, F is declared as a function pointer whose arguments are int and float, the return value is int type

int * (*g[]) (int,float);

Here the G is declared as an array, the elements of the array are function pointers, and the parameters of the function are int and float

The return value is a pointer to int*.

High-level statement (--C Primer, chapter 13th)

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.