------Java Training, Android training, iOS training,. NET training, look forward to communicating with you! -------
+A key word
A data type 5
Voidcharint Floatdoubleb of different constants--focus on "'" Data type---Process Control identifier--hump name first character lowercase, other uppercase single line comment//Multiline comment/**/common data type: int 4float 4double 8char 1-byte constant definition, the computer stored fixed, shape, implementation, character, string mastery changed the definition of a variable to represent the memory of a space variables name and variable type variables are divided into global variables and local variable variables use 1, define variablesformat: The name of the variable's type variableint a 2, initialization of the variable (empty) 3. Using variablesformat 2: Variable type variable name 1, variable name 2, variable name 3 int a,b,c,d; name specification for variable names 1. Alphanumeric underline, cannot start with a number. Strict adherence to the identifier of the naming code identifier cannot have # #. Variable name cannot have the same name as int a,b;int b; Define variables, initialize, use variable variable values: 1, the system of plastic 2, the last program left data 3, garbage number variable is defined after the value, to prevent the original value of the program has an impact, To initialize a variable initialization method: Define a colleague to initialize 1. Full initialization of the initialized format: Variable name = variable Value int num1 = 0,num2 = 0; 2. Partial initialization of int num3 = 0, num4;num4 = 443. Define variables first, post-initialize int num5,num6; NUM5 = 0; NUM6 = 0;4. Use a variable to initialize another Outside a variable int num7 = num5;//initializes the NUM7 with the value of NUM5 4. NUM1 = num2 = num3 =10 assignment to the left is the variable = b The use of the error variable: Note that the left side of the equal sign must be the right side of the variable equals argument, a constant, a variable, an expression on the left side of the equals sign cannot write a Constant key Difficulty---the scope of the variable (scope--the range you can use) local variables (inside of the function or inside of the code block). Internal variables, curly braces, function body) vs global variable code block: { curly brace statement } code block can be nested inside a code block can be defined and the code block outside the same name of the variable code block all free the scope of the local variable: starting from the position defined by the local variable, to a block of code or the "}" of the function body within the code block can be defined inside a variable with the same name as the outside of the block, the inside of the block will temporarily block external variables of the scope of the global variables using variables defined outside the function is a global variable, The scope starts at the defined position to the end of the file why the variable distinguishes between category int float4 byte 1 byte eight bits ---------------------------------------------------------printf Key format Controller printf ("Format control string", Output item list variable list); 1,% d---Output decimal number printf is the C language standard output library function using printf to keep the header file "stdio.h" printf use format pintf ("Format control string", variable list); 3. Format control%d outputs a decimal integer, placeholders , &NB Sp , &NB Sp , &NB Sp , &NB Sp , &NB Sp , &NB Sp  %F outputs a real-type data, cannot output integer data, outputs six decimal places, less than six bits, 0% C Output a character float f1 = 3.14f;char ch = ' A ';p rintf ("SB =%d\n", SB) ———————————————————————————————————— scanf (blocking function) in Stdio.h in scanF ("Format control string", entry Addresslist); Format Control string: composed of the format control and ordinary characters & get the address function execution, will wait for the user's input, if the user does not enter, will always wait for the scanf function: from the keyboard to receive the user input content, persisted to the specified variable scanf ("format control character", Enter an address list for the entry) scanfnot allowed to write%m.nf%MF canscanf accept the value of a single variable, before entering the value, if we enter a space carriage return, TAB will be ignored when you encounter a carriage return, will end execution after entering the first number, if the middle add carriage returns, spaces, ignore the mixed type will be a problem---plus commas about "*"%*d skip an integer%* C about \ n problem scanf try not to use \ n Break: Enter a value, enter a content. 2.\n to enter the principle of scanf when the user enters the content, the user input content will be stored in the scanf input buffer and then, SCANF will be based on the format control of the character's requirements, from the input buffer in order to remove the content it wants if the content from the buffer and our format requirements consistent, The value is stored in the variable if the format is inconsistent, then the value of the variable is not modified if the scanf buffer has content, it will not prompt us to enter a carriage return is also recommended if the integral type and character mix, you want to add a comma
------Java Training, Android training, iOS training,. NET training, look forward to communicating with you! -------
Dark Horse programmer iOS Foundation the next day printf, scanf