https://www.runoob.com/cprogramming/c-tutorial.html
1. EMACS editor
2. Several unfamiliar keywords
register | Declare register variables |
typedef | Alias for the data type |
volatile | Implicitly explanatory variable may be changed during program execution; forced each read data directly from memory, in case there is no time register is updated |
Add keywords C99
_Bool | _Complex | _Imaginary | inline | restrict |
C11 Add keywords
_Alignas | _Alignof | _Atomic | _Generic | _Noreturn |
_Static_assert | _Thread_local |
3. floating point type
类型 | 存储大小 | 值范围 | 精度 |
---|---|---|---|
float | 4 字节 | 1.2E-38 到 3.4E+38 | 6 位小数 |
double | 8 字节 | 2.3E-308 到 1.7E+308 | 15 位小数 |
long double | 16 字节 | 3.4E-4932 到 1.1E+4932 | 19 位小数 |
the printf ( " a float minimum:% E \ n- " , FLT_MIN ) ;
the printf ( " a float maximum:% E \ n- " , FLT_MAX ) ;
the printf ( " precision value:% D \ n- " , FLT_DIG ) ;
4. prinf output method using
https://www.runoob.com/cprogramming/c-function-printf.html
5. There are a range of signed numbers in bytes: -128 to 127 (the original code, complement)
6. The floating point type memory structure
float | 单精度浮点值。单精度是这样的格式,1位符号,8位指数,23位小数。
|
double | 双精度浮点值。双精度是1位符号,11位指数,52位小数。
|
7. variable declaration
Declare variables there are two cases:
- 1, one is the need to create storage space. For example: int a statement at the time had already established storage space.
- 2, the other is the need to establish storage space without defining it by using the extern keyword to declare the variable name. For example: extern int a variable a can be defined in another file.
- Unless extern keyword, or are defined variables.
8. Constant
- Integer constant
Integer constants can be decimal, octal or hexadecimal constants. Prefix specified radix: 0x or 0X for hexadecimal, octal 0, without the prefix, the default decimal.
May be an integer constant with a suffix suffixes U and L are combined, U denotes unsigned integer (unsigned), long integer L (long). Suffix can be uppercase, lowercase may be, U and L in any order.
- Floating-point constants
Floating constant consists of an integer part, a decimal point, a fractional part and exponent part. You can use decimal floating point or exponential notation to represent constants.
When decimal when expressed in the form must contain an integer part, the fractional part, or both include both . When using the index when represented in the form, it must contain a decimal point, index, or both include both . Unsigned exponent e or E is introduced.
3.14159 / * legal * / 314159E-5L / * legal * / 510E / * illegal: Incomplete index * / 210f / * Illegal: No decimals or index * / .e55 / * illegal: the lack of whole or fractional * /
- Character constant
Character constants are enclosed in single quotes, for example, 'x' may be stored in a char simple variable type.
A character constant is an ordinary character (e.g., 'x'), an escape sequence (e.g., '\ t'), or a universal character (e.g. '\ u02C0').
- String constant
Or a string literal constant is enclosed in double quotation marks "" in the. Similar to the character string contains a character constants: ordinary characters, and universal characters escape sequences.
- Define constants
There are two simple ways of defining constants:
- Use #define preprocessor.
- Use const keyword.
9. Storage Class
auto storage class
auto storage class is the local variables default storage class.
{ int mount; auto int month; }
Examples of two variables defined above with the same storage class, auto can only be used within a function, i.e., modified only auto local variables .
10.