C language data types
The C language is a statically typed language, which means that the types of variables must be declared at compile time. The basic data types available in C language are:
Integer type:
char
: one byteshort int
or short
: two bytes int
: four bytes (32 bits) long int
or long
: eight bytes (64 bits) ##Floating point type:
: four bytes (single precision)
: eight bytes (double precision)
Empty type:
: Indicates no type
Character type:
: Single character
Boolean type:
: Boolean value (
true or
false)
Others:
The integer type is used to store integer values (no decimal part). The size of the type depends on the system architecture.
Floating point typeThe floating point type is used to store approximate values with decimal parts. The
float type represents single-precision values, while the double
type represents double-precision values.
void
Type means there is no type. It is used to return no value (void
functions) or as a generic pointer type.
char
type is used to store a single character. It is also used in C language as a primitive type for strings.
The Boolean type is used to store Boolean values (
true or false
). It can use conditional statements and logical operators.
The above is the detailed content of What are the data types in c language. For more information, please follow other related articles on the PHP Chinese website!