Because the teacher touched the relationship between our teachers, I had to make up the base part of the previous one. He first lists a table of data types, as follows:
| Integer
| Character type
| Basic type <| single precision type
| | Real (floating point) <
| | Enumeration Type | Double Accuracy
|
Data type <| array type
| Construct Type | | Type (United) | Pointer type | Empty type The above table, the basic type is our usual use, including integer, characteristic, real (floating point), starting with the most common data type here. To talk about the data content of the C language, it is necessary to talk about what is stored in the computer. You should know that the computer can only handle the number of binary, because it is hardware relationship (bibly devices), these can only There are two states of representation, so it is particularly useful in the computer. From now on, we have to know all the data processed by the computer, then how do he calculate? Teacher first conversion to some of the counts into a number of binary counts, these pediatrics are of course no problem, very simple. The teacher, of course, we know that we will do, but in fact, we think that we can find a simpler conversion method when doing these topics. Example: (1011101) 2 = (93) 10 It is very simple to calculate, my method is the traditional calculation method. They all have their own rights, the first one is 20, the second is 21, followed by some types of push, will take the number of 1 to the number of points to add together, equal to 93. Here is that in fact, the second-party secondary is particularly good, just like our memory, 1-2-4-8-16-32-64-128-256-512-1024 ... Do you know this law? If you know if it is calculated, don't do it! However, the teacher puts forward a better way here, at least than a one plus it. It is the number of times the number to be converted to 111111, how much is this number? In fact, there is a skill in it, look at 100,000,000 minus 1! So, is it soon you know how much is 10000000, it's ok, it's 128, and then 1 is 127. On the basis of the two numbers of the original binary bit of zero, the first one Zero in the second, so 2, the second zero in the sixth place, so 32, add it to 127 to lose 93, is it very simple and convenient? (Learn something fast tuition fee) Ah, haha ~!). Do you know what kinds of calculations in binary in your computer? I am here to tell you, in fact, there is only such a kind, it is the addition operation (you don't tell me that you will even make a binary addition, it is actually a pong two). Why do you say this way? In fact, the binary also has subtraction operations and multiplication, but there is a method of complementing complement in the computer, which can convert the subtraction operation into an additional operation. As for how to implement teachers, there is no more discussion (in some additions, multiplication is also use shifts Implementation to additional). Now transferring into the integer data of the C language, the integer data of the C language is 2 bytes, which is 16 bits, up to 65536, and his range is -32768 to 32767. The C language is divided into symbol type and unsigned type. If there is no symbol, the range of integers is 0 to 65535. Regarding character data, if it is strict, there is no character in the C language, because he is stored is its ASCII code. Directly can be used and other data type operations, such as: main () {char s = 'a'; int i = 2; s = s i; printf ("% d", s); / * Here you can Outputs its ASCII code * / printf ("% c", s); / * Here the result is that the above statement changes the characters of the character S, then the 'c' * /} is more than the string, so String is only used in C language to represent the array, and other high-level languages are different, with their string types, but also characters and strings combined in the same type. Now let's talk about the real data, the type type is usually used in some of the data. Just like this: s = 1/1 1 / 3-1 / 5 1/7 ... 1 / 2N-1 This program is I wrote: main () {Int n, i, s; int R = 1; Printf ("please input:"); scanf ("% d", & n); for (i = 1; i <= n; i ) {s = s r / (2 * i-1); R = -1 * r;} Printf ("% d", s);}