1. source code and supplemental code
Example
'6': source code: 0110; supplemental code: 0110
'-6': source code: 1110; reverse code: 1001; Complement: 1010 = 1001 + 1
(-6) + 6 = 0110 + 1010 = (1) 0000 = 0;
When the complement code is obtained, the original code is obtained;
2. compilation process:
Pre-compile --> compile (assembly language) --> assemble (machine language) --> Link
3. 'chmod-R': you can modify all permissions of subdirectories and files in the directory.
4. Comparison between snprintf () and sprintf (): snprintf () requires the second parameter to specify the size of the target buffer to ensure that the buffer does not overflow.
The general programming model of a 5.32-bit UNIX system is called the ILP32 model, which indicates that INTEGER (I), long integer (L), and pointer (P) Both occupy 32 bits.
Data Type ILP32 model LP64 Model
Char 8 8
Short 16 16
Int 32 32
Long 32 64
Pointer 32 64
6. the suffixes for type conversion of Integer constants include: u or U (unsigned), l or L (long), u/U and l/L combination (for example: ul, lu, Lu, etc ). For example, 100u;-123u; 0x123l.
Use the suffix L or l to forcibly store integers in the long type.
All real numbers are stored as double.
7. Storage of constants in memory:
1 (0x0001): stored in memory in unsigned short (two bytes;
'1' (0x31): one byte;
"1": The String constant must end with '\ 0', which occupies two bytes.
8. scanf () input end condition:
A. in case of space, TAB, or press ENTER
B.
C. Illegal characters
If scanf () has a return value, "1" is returned successfully. If it fails, "0" is returned ".
9.
A: for (I = 0; I <n; I ++)
A [I] = 4;
B: for (p = a; p <a + n; p ++)
* P = 4;
(A) Start With a and move the I elements forward. This is required for each assignment. "[]" is an operator.
(B) it is enough to move one unit behind each time. (B) The efficiency is significantly higher.
10.% f and % lf
():
<Stdio. h>
Int main ()
{
Int a, B, c;
Double y;
A = scanf ("% lf", & y );
Printf ("% d, % f, % lf \ n", a, y, y );}
Enter 1234567891234567890
Output 1, 1234567891234567936.000000, 1234567891234567936.000000
Gdb:
Breakpoint 1, main () at 12_11_4.c: 7
7 a = scanf ("% lf", & y );
(Gdb) s
12345678912345678912
8 printf ("% d, % f, % lf \ n", a, y, y );
(Gdb) p y
$2 = 1.234567891234568e + 19
(B ):
# Include <stdio. h>
Int main ()
{
Int a, B, c;
Double y;
A = scanf ("% f", & y );
Printf ("% d, % f, % lf \ n", a, y, y );
}
Enter 123.11
Output 1, 0.000000, 0.000000
Why is the second output zero?
Check gdb debugging:
Breakpoint 1, main () at 12_11_4.c: 7
7 a = scanf ("% f", & y );
(Gdb) s
1234.123
8 printf ("% d, % f, % lf \ n", a, y, y );
(Gdb) p y
$1 = 4.8545332942524682e-270
1234.123 is read successfully, but the storage format is float.