Origin
1950 Transistor Computer era, the United States and Europe, the Joint Conference of Computer Science Co-development ALGOL (algorithmic Language), also known as a language. In 1963, Cambridge University ALGOL 60 languages into CPL (Combined programming Language) language. In 1967, Dennis Macalistair Ritchie (Dennis Macalistair Richie) of the University of Cambridge simplified the CPL language and introduced the BCPL (Base Combined programming Langurage) language. Brian Wilson Kernighan (Blaine Wilson Collingham) of the American Bell Laboratory in 1970, based on BCPL language and further simplified, designed a very simple and very close to the hardware of the B language (take the first letter of Bcpl), and in B language wrote the first A UNIX operating system. 1972~For 1973 years, Bell Labs ' Dennis M.ritchie designed the C language (the second letter of BCPL) on the basis of B language. In 1977, Dennis M.ritchie published the C language compiler text "Portable C Compiler program" that does not depend on specific machine systems. In 1978, Brian W.kernighian and Dennis M.ritchie co-published the famous book "The C Programming Language", called by C-language developers "K&R C ". In 1989, ANSI released the first full C language standard--ansi X3.159—1989, referred to as "C89", but people also used to call it "ANSI C". 1990, ANSI C was adopted by ISO, named ISO/iec9899:1990, referred to as "C90". In 1999, after making some necessary corrections and improvements, ISO issued a new C language standard, named ISO/iec9899:1999, referred to as "C99". December 8, 2011, ISO formally released a new standard, called the ISO/iec9899: ., referred to as "C11".
Advantages1, simple and compact, flexible and convenient2, operator Rich3, rich data types4, flexible and practical expression mode5, allows direct access to physical addresses, and operates on hardware6, high quality of generated target code, high program execution efficiency7, good portability8, strong expression strength, weakness1, C language shortcomings mainly in the packaging of the data, which makes C in the data security has a great flaw, which is also C and C + +a big difference. 2, C language Grammar restrictions are not strict, the type constraints of the variable is not strict, affecting the security of the program, array subscript out of bounds do not check. From an application perspective, the C language is more difficult to master than other high-level languages. That is to say, for people who use C language, they need to be more proficient in programming.
C language Keywords
The keyword is a word that has been used by the C language itself and cannot be used for other purposes. For example, keywords cannot be used as variable names, function names, and so on.
the C language keywords defined by the ANSI standard total of 32: AutoDouble int struct Break Else Long Switch Case enumRegister typedefChar extern returnUnionConst float ShortUnsignedContinue forSignedvoid default Goto sizeof volatile Do if while Static
C99 Standard added 5 keywords: inline inline function, more in C+ + , it is an optimization implementation of macro definition restrict It can only be used to qualify and constrain pointers, and indicates that the pointer is the only and initial way to access a data object _bool unsigned int , defined as a Boolean in C99, can hold only 0, 12 values _complex Complex class type _imaginary pure virtual function type
C11 standard new 1 keywords: _genneric generics
Depending on the role of the keyword, you can divide the keywords into data type keywords and process Control keywords two major categories:
I. Data type keyword A. basic data Type (5)void: Declaring a function with no return value or no parameter, declaring an untyped pointer, and explicitly discarding the result of the OperationChar: Character type data, which is an integral type of dataint: Integer data, usually the machine word length specified by the compilerfloat: Single-precision floating-point data, a type of floating-point dataDouble: Double-precision floating-point data, which is a type of floating-point data B. Modifier Keywords (4) Short: Modifier int, short integer data, can omit the modified int. Long: Modifier int, long shaping data, can omit the modified int. Signed: Modified integer data, signed data type unsigned: modified integer data, unsigned data type C. Complex type keywords (5)struct: struct declaration union: Common Body Declarationenum: enum declaration typedef: declaring type aliassizeof: Gets the size of a particular type or type of variable D. Storage-level Keywords (6) Auto: Specified as an automatic variable that is automatically assigned and freed by the compiler. Usually allocated on the stackStatic: Specified as a static variable, assigned in the static variable area, when the modifier function, the specified function scope is the file internal register: specified as a register variable, it is recommended that the compiler to store variables in the register to use, you can also modify the function parameters, it is recommended that the compiler pass the parameter through the register instead of the stackextern: Specifies that the corresponding variable is an external variable, that is, the definition of a variable or function in another file, prompting the compiler to find its definition in other modules when encountering this variable and function. Const: As with volatile, "CV attribute", the specified variable cannot be changed by the current thread/process (but it is possible that the system or other thread/process Change)volatile: With the const collectively referred to as "CV attribute", the value of the specified variable may be changed by the system or other process/thread, forcing the compiler to get the value of the variable from memory every time
ii. Process Control keywords A. Jump structure (4)return: Used in the body of a function to return a specific value (or void value, i.e. no return value)Continue: Ends the current loop and starts the next cycle Break: Jumps out of the current loop or switch structureGoto: Unconditional Jump Statement B. Branch structure (5)if: Conditional statement, do not need to put a semicolon behindElse: Conditional Statement Negation branch (with IF)Switch: Switch statement (multi-branch statement) Case: Branch marks in a switch statementdefault: The "other" branch in the switch statement, optional. C. Circular structure (3) for: For loop structure, for(1;2;3)4; The order of execution is 1->2-4-3-2.. Loop, where 2 is the loop condition. In the entire for loop, expression 1 is evaluated only once, and expression 2 and expression 3 may be evaluated multiple times or not at once. The loop body may be executed more than once, or it may not be executed at one time. Do: Do loop structure, Do 1 while(2); The order of execution is 1->2-1.. Cycle, 2 for cycle conditions while: While loop structure, while(1)2; The order of execution is 1->2-1.. Loop, 1 is the loop condition above the loop statement, when the loop condition expression is true the loop continues, and the loop jumps out for the false.
C language 34 kinds of operators
Sort by priority from highest to lowest, and empty line priority drops one level.
() parentheses [] subscript-pointer-type struct member. struct Members/*Monocular and right associative operation*/!Logical Non-~- bit non-++Self-increment--Self-reduction-take negative (type) type conversions*Fetch Content&Fetch Addresssizeofto find the data type or the length of an expression/*Monocular and right associative operation*/ /** Binocular, left associative operation **/*Multiply/except%Seeking Redundancy+Plus-minus<<Move left>>Move Right<less than<=less than or equal>Greater than>=greater than or equal==equals!=Not equal to&bit and^bit XOR or|bit or&&with the||or/** Binocular, left associative operation **/?: Conditional operation/** * three eyes, right combination operation * **/= Assignment operation (+ =,-=, *=,/=,%=, >>=, <<=, &=, ^=, |=), comma operation
Introduction to C language-overview