C Language Notes finishing full version __c language

Source: Internet
Author: User
Tags arithmetic logical operators

End of November 9, 2016 18:09:02

———————————————————————— October 31, 2016 21:23:34 ——————————————————————————

1. What is a program: A program is a sequence of instructions used to accomplish a specific function
2. Language classification: Low-level language: machine language, assembly language advanced languages: C,basic ... Object-oriented language: C++,vb,java ...
A program written in a high-level language is translated into two ways that the computer can identify the target program: (1) Compile execution is to translate the source program into an executable target program, which is divorced from the compilation environment and source program, independent Existence and Execution (2) Interpretation execution is to interpret the source program as a binary instruction, explain a sentence to execute a sentence , do not generate executable files, slower execution than compilation
3. The history of the C language: http://baike.baidu.com/link?url= Mxlo7rawbghoj1exgibbo5rxfk11knccejo28xs1339s2tiwtlnrngqyc9pdzma1h2572-1rxs3flofhx03pjvfo50ldunjf2h9kl_ Bnwnqmhjmjzeqeteclup6zmm7ngxs-vsbscoqhhxy_zshbl_
4. Computer system Structure:--von Neumann (1) The computer is composed of the controller, the calculator, the memory, the input equipment and the output device 5 parts (2) The computer uses the binary system, the instruction and the data all in the binary number form representation and the storage (3) The computer according to the procedure stipulation Order takes the instruction out of the memory and executes one by one the nature of the program design: Designing a sequence of instructions that can accomplish a specific task with 5 parts of the computer
5. Algorithm and its characteristics: definition: A series of steps used to solve a problem: poor, deterministic, input, output, feasibility presentation: Natural language, pseudo code, flow chart, n-S flowchart
6. Structured Programming Method: (1) Program organization structure (principle is to any program in order structure, select structure, cycle structure as basic unit organization) (2) program adopts Top-down, gradual refinement, function modular method
7. Ascii:http://baike.baidu.com/link?url=ighzhnhgup_l70abla_ qns1bmp4libmzyxxgr1cpqnx69ucbtqfgbg9waizi9tnyd2kcjbnr4baw67i1kxq5mxtqpcg2csz7dvg9xeyegym2lsxl88p8yscxtigtornt6t2taf6lgt8u Uk6f1ecmvh7rfwupeno1ldf2vwqvtvm
8. void Main (int argc, char *argv[]) ARGC: Number of arguments in the command line argv[]: An array of pointers, with each element pointing to the string in the command line C programs consist of functions and include at least one main () function, while M An function can only have two parameters, generally written as argc and argv this form, can be in Operation command state, call main function in fact, most of the time does not write, and does not call the main function

October 31, 2016 21:23:34

Freshman textbook looked, feel no dry goods, found the previous two notebooks I wrote, every day with the contents of a new notebook

One is in the freshman summer self-study haobin video record, the other one is in a sophomore in the library to find the book of their own collation, later content will be combined with two updates.

1. What is a program: A program is a sequence of instructions used to accomplish a specific function
2. Language classification: Low-level language: machine language, assembly language advanced languages: C,basic ... Object-oriented language: C++,vb,java ...
A program written in a high-level language is translated into two ways that the computer can identify the target program: (1) Compile execution is to translate the source program into an executable target program, which is divorced from the compilation environment and source program, independent Existence and Execution (2) Interpretation execution is to interpret the source program as a binary instruction, explain a sentence to execute a sentence , do not generate executable files, slower execution than compilation
3. The history of the C language: http://baike.baidu.com/link?url= Mxlo7rawbghoj1exgibbo5rxfk11knccejo28xs1339s2tiwtlnrngqyc9pdzma1h2572-1rxs3flofhx03pjvfo50ldunjf2h9kl_ Bnwnqmhjmjzeqeteclup6zmm7ngxs-vsbscoqhhxy_zshbl_
4. Computer system Structure:--von Neumann (1) The computer is composed of the controller, the calculator, the memory, the input equipment and the output device 5 parts (2) The computer uses the binary system, the instruction and the data all in the binary number form representation and the storage (3) The computer according to the procedure stipulation Order takes the instruction out of the memory and executes one by one the nature of the program design: Designing a sequence of instructions that can accomplish a specific task with 5 parts of the computer
5. Algorithm and its characteristics: definition: A series of steps used to solve a problem: poor, deterministic, input, output, feasibility presentation: Natural language, pseudo code, flow chart, n-S flowchart
6. Structured Programming Method: (1) Program organization structure (principle is to any program in order structure, select structure, cycle structure as basic unit organization) (2) program adopts Top-down, gradual refinement, function modular method
7. Ascii:http://baike.baidu.com/link?url=ighzhnhgup_l70abla_ qns1bmp4libmzyxxgr1cpqnx69ucbtqfgbg9waizi9tnyd2kcjbnr4baw67i1kxq5mxtqpcg2csz7dvg9xeyegym2lsxl88p8yscxtigtornt6t2taf6lgt8u Uk6f1ecmvh7rfwupeno1ldf2vwqvtvm
8. void Main (int argc, char *argv[]) ARGC: Number of arguments in the command line argv[]: An array of pointers, with each element pointing to the string in the command line C programs consist of functions and include at least one main () function, while M An function can only have two parameters, generally written as argc and argv this form, can be in Operation command state, call main function in fact, most of the time does not write, and does not call the main function

—————————————— November 1, 2016 18:34:38 ———————————— 1.                 The basic type of data type of C language: the so-called "basic", refers to the data type whose value can not be decomposed again. Integral type: Single-precision double-character enumeration type
Construct type: Construct new data type array type structure body type common body type with one or more existing data types
Pointer type: Used to represent the address of a variable in memory
Null type: A type specifier is void and is commonly used to define a function that has no return value
2. Variable variables must be defined before use. When you define a variable, the system automatically detects the amount of storage space required, and then assigns a storage cell identifier to a variable that can only consist of letters, numbers, and underscores, and the first word Fu Bi The initial value of a letter or underscore variable: (1) Initialization: Assign an initial value to a variable while defining the variable ( 2) First define the post assignment
3. Constant (1) Literal constants: integer constants, real constants, character constants (Required ') (2) Symbolic constants: An identifier representing a constant #define identifier constant (3) const constant: read-only constant: const type identifier variable label identifier = initialization data or type identifier const variable identifier = Initialization data can only be initialized at definition and cannot be assigned, somewhat like the final in Java
4. The eight prefix is 0, and the hexadecimal prefix is 0X
5. Input and output of integer data (1) standard input/output file #include <stdio.h> #include: preprocessing command, including header file to user's source program STDI O.h: Standard input/output header file, providing prototypes of input and output functions
(2) printf usage: ①printf ("string") ②printf ("Output control character", output parameter) ③printf ("Output control character 1 output control character 2 ...", output parameter                 Number 1, output parameter 2 ...)             Number must match ④printf ("Output control Fu Fei output controller (such as escape character)", output parameter) Why do I need output control character: ① code consisting of 01 can represent data and can represent instructions ② if 01 of the code represents the data, then the same 01 code combination has different outputs with different outputs
(3) scanf usage: Converts a character entered from the keyboard into data in the format specified by the input controller, and then into a variable with the address of the value of the input parameter ①scanf ("Input control character", enter the entry address list) ②SC ANF ("Non input controller input controller", input parameter) the non-input controller must be entered as is
Example: scanf ("m%d", &i) if the keyboard is typed: m123n, then output I show 123
scanf ("%d,%d,%d", &i,&j,&k);             printf ("i =%d,j =%d, K =%d", I, J, K); If the keyboard type: 1 (space) 2 (space) 3 output: i = 1,j = (garbled, unpredictable), 3 = (garbled) so the characters are not discarded

scanf ("%c", &a); Returns are logged, that is, ' \ n ' is also entered in a, but%s is not,%s ends with a space and carriage return
6. Integer data in memory storage way to the form of complement to store, positive source code, inverse code, complement the same; negative complement = inverse code +1
7. Real constants and variable name digits valid number float 6~7 double 64 15 ~16 long double 64 15~16 the number of valid digits determines the accuracy of the data floating-point data inaccurate storage
Input and output of real data: M.N m is a domain wide n for precision high-precision and low precision operation, the result is high precision
8. Real data stored in memory in addition to the number of significant digits will be discarded, so the number of digits to determine the accuracy of a significant number of decimal and exponential parts, respectively, stored as: +123.567 + 123567 +  3 Number of symbol bit | Digital Part | index sign bit | Index
9. Character-type constants, escape characters, and variable (1) Character constants: "Surround It With" (2) escape character: "\" followed by a character, representing a special control character (3) character variable: char, a character variable occupies a byte of memory space, can hold a character
Input and output of character data: (1) basic input-output function: i = GetChar (), Putchar (i) (2) format input and output function: scanf,printf
strings are enclosed with "", including escape characters
10. Arithmetic priority arithmetic > Relation > Assignment > Logical comma expression: expression 1, expression 2 .... The value of the expression N total expression is the value of the right expression N, and is the lowest of all levels such as: i = 1+1,2+2;//i is 4
11. Conversion of data Types     (1) Implicit conversions: ① conversions make the byte length of the data longer and the precision becomes higher.                          such as float to double,short and char to int          When           ② assignment, the data precision on both sides of the equals sign is different, then the right becomes left                              such as: int i = 1.234;    //i 1     (2) Coercion type conversion:                  (type name) (expression)                  only temporarily converts the result, not changing the data type of the variable                  such as: double k = 1.234;                     int i  = (int) k   ;   //I to 1
int *p;    p = (int *) malloc (siezof (int)); WHERE (int *) is coercion type conversion

—————————————————— November 2, 2016 23:57:42 —————————————— 1. logical operators and Logical expressions A&&b&&c A is false, no longer judge B,c; only a true, B true case, only Judge C a | | B | | c A is true, then no longer judge B,c; only a false, B false case, only Judge C
2. If if (expression)//The expression is true, else it is not followed by the judgment statement statement; Else//else is always paired with the most recent unpaired if pairing statement;
3.switch switch (variable or constant)//each case and default order does not affect the run {case constant expression: statement;                    You can add a break after each case to jump out of the switch or else the next case will be executed ... default: statement; If the matching case does not have a statement, the statement of the next case will be executed}
4. Expression 1. Expression 2: Expression 3 1 True, then execute 2, otherwise execute 3
5.while      while (expression P)          //First Judge p, enter loop for true      {Circular statement}   &

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.