"C Programming Language" note (ix) Reference manual 1

Source: Internet
Author: User
Tags numeric value

A.1 Introduction A.2 The law of the word
A program consists of one or more translation units stored in a file the translation of the program is divided into several stages to complete the first stage of translation to complete the low-level lexical transformation to execute the instruction in the line beginning with the character #, and macro definition and macro extension after preprocessing is completed, the program is defined as a sequence of tokens.

Mark
There are 6 types of tokens in the C language: identifier keyword constant string literal operator other separator space Landscape tab and Portrait tab newline character page break and comments are used only to delimit tokens in a program and therefore are ignored adjacent identifiers The key and the constant need to be separated by a whitespace character if the input to a character is left separated into several tokens then the next tick is the longest string that may be the symbol in the subsequent sequence of characters.

Comments
Comments with character/ * // End comment cannot be nested or appear in string literal or character literal

Identifier
Identifiers are composed of letters and numbers the first character must be a letter, the underscore is also considered to be the letter uppercase and lowercase letters are different identifiers can be any length corresponding to the internal identifier, At least the first 31 letters are valid internal identifiers include pre-processor macro names and all other names with external links that have no external links are more restrictive, the implementation may be considered valid for the first 6 characters of these identifiers, and may ignore case

  

Key words
The following identifiers are reserved as keywords and cannot be used for other purposes auto Double int structbreak else long switchcase enum Register typedefchar extern return Unionconse  Float short unsignedcontinue for signed voiddefault Togo sizeof Volatiledo if static while some implementations also leave Fortran and ASM as keyword const keyword Signed  and volatile are new additions to the ANSI standard enum and void is the first version after the addition of the entry was once reserved word, but not used, and now is not the

  

Constant
There are several types of constants. Constants for each type have a data type constant: integer constant character const floating-point constant enumeration constant 1. Integer constants consist of a string of numbers if it starts with the number 0, then 8 is the binary, otherwise 10 octal constants do not contain 8 and 9 digits starting with 0x or 0X are 16, and the 16 binary contains a (a) to F (F) If the letter integer constant with u or u suffix, indicating an unsigned number if the L or L suffix, indicating a long integer if a UL suffix, indicating an unsigned long integer 2. A character constant character constant is a sequence of one or more characters that are caused by single quotation marks, such as ' X ' The value of a character constant is the numeric value of this character in the machine's character set at execution time, and the value of a multi-character constant is defined by a specific implementation of character constants excluding characters ' and newline characters that can be represented by the following escape character sequence and some other character newline characters \ n horizontal tab \ t portrait tab \v fallback \b Carriage return \ R page Break \f ring character \a backslash question mark  \ ' double quotation mark \ ' octal number \ 6 binary number  \xhh escape sequence \000 by backslash followed by octal values these octal values are used to specify the desired character value, which is a common example, Represents the character null escape sequence \xhh backslash followed by an X and a hexadecimal value, indicating that there is no limit to the number of expected character values, but if the character value exceeds the maximum character value, the behavior is undefined 3. Floating-point constants are represented by an integer decimal point and an E (e) An exponent of an optional signed integer type and an optional representation type suffix (f f l l) consisting of integers and decimals consisting of a sequence of numbers that can have no integers or fractional parts (but not both) can also have no decimal or E and exponential parts (but not both) the type of the floating-point constant is determined by the suffix F (f) indicates that the float type L (l) indicates that a long double type has no suffix for the double type

  

String literals
string literals, also known as String constants, are the type of a character sequence string that is caused by double quotation marks . " character Array " , the storage class is static. It uses the given character to initialize whether the same string literals are differentiated depending on the implementation if the program attempts to modify string literals, then the behavior is undefined we can concatenate adjacent string literals into a single string after performing any connection operation, Will add a null character after the string \0 so that the program that scans the string can find the end position of the string literal does not include line break and double quote characters but can be represented by a sequence of escape characters that are the same as the character constants

A.3 Syntax Symbols
In the syntax symbols used in the manual, the grammar category uses italics and italics to denote words and characters in font style to indicate that multiple candidate categories are usually in different rows, but in some cases a short set of characters can be placed on one line and the optional terminator or non-terminator with  subscript opt{expression opt} indicates that an expression enclosed in curly braces is optional

  

Meaning of the A.4 identifier
Identifiers are also known as names that can refer to multiple entity function Structures Tag Union tag enumeration tag struct member or union member enumeration constant type definition name designator and object and so on sometimes called variable, It's a storage location for its interpretation depends on two primary properties storage classes and type storage classes determine the lifetime type of the store associated with the identity object the value in the object name also has a scope and a connection scope in which the name can be accessed by an area connection in the program that determines whether the same name in another scope points to the same object

  

Storage class
Storage classes fall into two categories: the automatic storage class static storage class declares an object using some keywords and the context of the declaration together determines the object's storage class auto-storage class object is local to a block, the object disappears when exiting the program if the storage-class descriptor is not used or using the Auto qualifier, the declaration in the block generates an object that is declared as register by an auto-store object, and that is stored in the machine's fast register. A static object can be a local object of a program, or it can be an external object of a program block, regardless of the case The exit and re-entry function or block is its value will remain unchanged in a block, Static objects use the keyword static declaration that is declared outside of all the blocks and that objects that are defined at the same level as the function are always static and can be declared as a local object of a particular translation unit by the static keyword this type of object will have internal links when omitting an explicit storage class or declaring it through the keyword external , the object degree is globally accessible throughout the program and has external links

  

Base type derived type type qualifier A.5 object and lvalue a.6 conversion integral ascending integer conversion integer and floating-point number floating-point type arithmetic type conversion pointer and integer void pointer to void

"C Programming Language" note (ix) Reference manual 1

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.