Command + "<stdio. h>" Enter the header file content several lines, comment and SELECT command +/new project (select xcode): Command + Shift + n // Annotation, which is ignored during compilation: 1> the annotated code does not participate in compilation. l annotation is intended for users rather than computers. How Can computers view the Chinese we write. Therefore, when compiling a program, it does not compile the annotation. O from. o file size can be indirectly seen that the annotated code is not compiled 2> check the role of the Code 3> exclude Error 1. note: 1) After the compiler removes the comments, it will replace the original comments with spaces. Example: int /*.... */I; correct 2) double quotation marks all result from string constants, // no exception to char * s = "abcdefgh // hijklmn"; correct
Printf ("// itcast \ n"); // outputs
3) A backslash (\) is used in C to indicate a broken line. The compiler removes the backslash and the characters following the backslash are automatically followed by the previous line. However, note: there must be no space after the backslash and no space before the next line of the backslash. Of course, you can test the effect after spaces are added. Example:, // is it a \ valid comment? Legal 4 )/*...... */Examples of non-nesting:/* this is/* illegal */. */Valid because/* is always closest to it */matching example: // 1) single-row comment can be nested with single-row comment and multi-row comment
// Sister-in-law //
/// * Ghjkkll; * // 8900 jjkklll
// 2) multi-line comments can be nested with single-line comments
/*
// Author; Al
// Description: This is a slave language program.
Role: This is a main function, the entry point of the C program
*/
// 3) multi-line comments cannot be nested with multi-line comments
/* Hahahahahah
/* Xixixixixixixixi */
Hahhehhhhehhhhhh */
// Write legislation incorrectly:
///*
Hahahhahhahha
*/ C language basic data types (allocating different memory) integer short (INT) (2), INT (4), long (INT) (4 (32-bit operating system) or 8 (64-bit operating system) float (4), double (8) character char (1) single quotation mark 'A' common error: Char c =; char c = "A"; char c = 'abcd'; char c = 'male'; char a [1000]; int I; for (I = 0; I <1000; I ++) {A [I] =-1-I;} printf ("% lu \ n", strlen (a); note: the output result is: 255 Constant: The value const that will not be changed during the program running is a read-only variable. It does not know its content during compilation, and its value cannot be used during compilation. Note: const Read-Only variables are non-mutable and can only be initialized at the time of declaration. For example, const int Max; max = 100; the const variable behavior in C is more like a non-const variable, but in CPP, the behavior of the const variable is like # define because in C ++, the value of the const variable is calculated during compilation, so it can be used in the case statement, while in C, the const value is only the address of a variable during compilation. Therefore, it cannot be used in case statements. Variable: represents a storage region. The value used in the storage and computing process. Any variable must be defined before use. When declared, it is allocated space for it. Int A = 3; ("=") int B = 5; A + B; 3 + 5; (there are many memories named 3 and 5 in the memory, not sure) type modifier (INT, double, etc.) variable name = initialization; the number of different precision addition, close to the high precision. For example, the result of 4 + 3.0 is decimal (3.0 type ). For example, the percentage of 4 in 5 can be 1.0*4/5; Naming rules for variable names: 1. It consists of numbers, letters, and underscores. 2. It must start with a letter or underline. 3. Variable names cannot be repeated. 4. Reserved Words cannot be used. 5. $ can exist as a variable name. 6. case sensitive.
Opening part, comment, basic data type, constant variable, name