Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Four Basic Data Types of C Language
Four Basic Data Types of C Language
C language has four basic data types: integer, floating point, pointer and aggregation type (array and structure).

1, the integer family has nine data types: char, signedchar, unsignedchar, short integer, unsignedshortv integer, integer (intv), unsignedint, long integer (? Long), unsigned long.

2. Floating-point type: Floating-point type includes single-precision type and double-precision type.

(1) Single precision type: generally 4 bytes (32 bits), floata = 4.5.

(2) double precision type: generally 8 bytes (64 bits), double? a=4.5 .

3. A pointer is an object in a programming language, and its value directly points to a value stored in another location in computer memory by using an address.

4. Aggregation refers to the content selection, analysis and classification of related data, and finally get the desired results through analysis, mainly referring to any data conversion process that can generate scalar values from arrays.

Extended data:

Naming rules of variables in C language;

1, the naming should be intuitive and spelling, and it is expected to understand the meaning and be easy to remember and read.

It is best to use English words or their combinations as identifiers, and pinyin is not allowed. English words in general programs should not be too complicated, and words should be used accurately.

2. The naming length shall meet the requirements of "minimum length"; & Maximum information "principle.

C is a concise language, and its name should be concise. For example, the variable name MaxVal is better than MaxValueUntilOverflow. Generally, the length of identifiers should not be too long. Longer words can be abbreviated by removing vowels.

3. When the identifier consists of multiple words, the first letter of each word is capitalized and the rest are all lowercase.

For example: intCurrentVal;;

Such a name seems clear at a glance, far better than a long string of characters.

4. Try to avoid using numerical numbers in names, such as Value 1, Value2, etc. , unless it is logically necessary to number. For example, when developing drivers, it is not good to name the pins without numbering them.

5. Add a range qualifier (it is recommended to use the module name (abbreviation) as the range qualifier) for the global variable or function used together among multiple files, such as GUI_.

Baidu encyclopedia-integer

Baidu encyclopedia-floating point type

Baidu encyclopedia-pointer

Baidu Encyclopedia-Variable