Rectification's book, today saw 56 pages, the past few days through other ways to learn these basic knowledge, this is a review, some of the knowledge of constant variables, constants include:
1, integral type constant, is the general integer bar.
2, the real type constant, is divided into two decimal decimal forms, consisting of numbers and decimal points, such as 1.453
3, character constants, divided into ordinary characters and escape characters, ordinary characters to be enclosed in single apostrophes, such as ' a ' 3 '! ' Can not be written as ' Ab ', the character constant storage is stored in code (refer to ASCII code). An alphabetic sequence, such as \ n, that the escape character begins with \
Textbook 40 pages with table
4, string constants, such as "Boy" "123", etc., note that a single apostrophe can contain only one character, and a double apostrophe may contain a string.
5, symbolic constants, using the # define directive, specify a symbol name to represent a constant.
The above copy of the book on the concept, still understand it;
Variable I feel there is no need to say, I already know, haha.
Integral type data:
Basic integer (int), the compiler allocates two or four bytes for it, a byte 8 bits, the storage unit is stored in the form of an integer complement, I do not know what is the complement! My understanding is that the decimal into binary storage, and then stored in those bits of bytes, if it is two bytes should have 8 bits to store the binary number, such as 5 of the binary is 101, then is:
| 0 0 0 0 0 0 0 0 |
0 0 0 0 0 1 0 1 |
The first 0 represents a positive number, so the maximum can only be 0111111111111111 is 32767, the first digit if 1 is a negative, the smallest can be 1000000000000000 is the decimal-32768, so the range is -32768~ 32767. This is a two-byte case!
A short int or a shorter
A long int or a longer integer
Double-long integer long int or long long
Range of values for integer variables I don't know if I want to remember, the book is P45.
The other is "signed" and "Unsigned."
Unsigned is only positive, plus modifier unsigned line, signed modifier signed generally omitted, such as unsigned int; Of course, if the unsigned type, then the first 0 and 1 is not the positive and negative points, so just above the range will become 0~ 65535 the feeling is easy to understand Ah!
I want to remember the character variable, which is a character variable that is defined with a type character char. Like Char c= '? ’
Defines c as a character variable, '? ' The ASCII code is the 63 system assigns the integer 63 to the variable C
Output in decimal is output with%d as character is%c
printf ("%d%c\n", c,c);
The output is: 63?
While the same unsigned char can extend the range of values is 0~255,char -128~127 but the code is not likely to be negative, so in the store character is valid is 0~127
Floating-point variables need to look again!
This article from "Edge-Kobayashi" blog, reproduced please contact the author!
The simplest C program