C basic knowledge Review

Source: Internet
Author: User

C Development History

C was originally designed for the development of UNIX operating systems. In this case, C should be available earlier than UNIX, but this is not the case. The earliest Unix was written by assembly;

C language was originally developed by Americans. It is best to read c statements in English;

Steps for interpreting the C statement:

1. First, focus on the identifier (variable name or function name)

2. The derived type (pointer, array, and function) is interpreted in priority from the point closest to the identifier ). The priorities are described as follows:

A. brackets used to sort the declared content;

B. used to represent the [] of the array, used to represent the () of the Function ()

C. used to represent the pointer *

3. Explain the derived types and link them with "of", "to", and "returning;

4. Finally, append the Data Type modifier (on the left, Int, double, etc)

INT (* func_p) (double );

1. Focus on the identifier. That is: func_p/*/func_p is

2. Because there are Parentheses, focus on the brackets *:/*/func_p is pointer

3. Focus on the brackets used to sort the Declaration content:/*/func_p is pointer to function (the parameter is double) Returning

4. Finally, explain the Data Type modifier INT:/*/func_p is pointer to function (the parameter is double) Returning int

Translate to Chinese: func_p is a pointer to a function whose return value is int;

C language statements cannot be interpreted from left to right in order, but from left to right;

INT (* func_table [10]) (int );

Func_table is array (10 elements) of pointer to function (INT type) Returning int

Adds a pointer. the pointer only advances.The distance between the pointer and the type size is very important;

"Pointer to array ",

Error understanding: Does the array name not contain []? Isn't it a "pointer to an array?

Indeed, in an expression, an array can be interpreted as a pointer. However, this is not a "pointer to an array", but a "pointer to an array's initial element"

(Next is the span issue involving a + 1 pointer, which is a classic issue)

 

 

 

 

 

 

 

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.