In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
C language has rich data types, so it is very suitable for writing databases, such as DB2, Oracle are written in C language.
The data types of C language can be roughly divided into several categories in the following figure:
Storage length of basic data types in different compiler environments
The red ones represent common data types.
In a 64-bit compiler environment, short takes 2 bytes (16 bits), int takes 4 bytes (32 bits), and long takes 8 bytes (64 bits). There are many compilers in the world, and the range of values and the length occupied vary from compiler to compiler, but fortunately, ANSI\ ISO makes the following rules:
* short and int are at least 16 bits (2 bytes)
* long is at least 32 bits (4 bytes)
* the length of short cannot be greater than that of int,int, and the length of int,int cannot be greater than long.
* char must be 8 bits (1 byte). After all, char is the smallest data type we can program with.
Second, variables
In C language, variables are used to store the values used in the calculation process, and any variable must define the type before using it. Why do you have to define variables first? Because the type of variable determines the storage space occupied by the variable, the variable type is defined in order to allocate the appropriate storage space for the variable to store data.
1. The use of local variables is slightly different from that of Java
1 > in Java, after you declare a local variable, if you use the variable without initializing the assignment, the compiler reports an error directly
Line 9 reported an error because the variable a was not initialized
2 > in C language, after you declare to see a local variable, it can be used without initialization assignment.
1 # include 2 3 int main () 4 {5 int b; 6 printf ("% d", b); 7 return 0ten 8}
But this is very dangerous and is not recommended. Most people should think that the variable b should be printed as 0, but sometimes it's not. Because the system will assign a value to the variable b at will, the result is junk data.
The printed result of the above code is: therefore, the local variable must be initialized and then used, which is the safest thing to do.
* if it is a global int type variable, the system will default to 0.
Type modifiers
That is, some modifiers are added before the basic data types, and some people call them qualifiers.
There are four types of modifiers:
Short short type
Long long type
Signed has symbolic type.
Unsigned unsigned type
Example:
These modifiers are most commonly used to modify int types (int can be omitted)
1 / / the following two ways of writing are equivalent: 2 short int S1 = 1; 3 short S2 = 1; 4 5 / / the following two ways of writing are equivalent 6 long int L1 = 2; 7 long L2 = 2; 8 9 / / you can continuously use 2 long10 long long ll = 10 long10 long long ll 11 12 / / the following two ways of writing are equivalent 13 signed int si1 = 314 unsigned int us1 = 3x 15 16 / / the following two ways of writing are equivalent 17 unsigned int us1 = 4X 18 unsigned us2 = 4 19 20 / / you can also use both modifiers 21 signed short int ss = 5 unsigned long int ul 22 / 5
Signed stands for signed, including positive number, negative number and 0 position unsigned for unsigned, including only positive number and 0. For example, if the value range of signed is-32768 / 32767, then the value range of unsigned is 0,65535. Of course, different compilers have different values.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.