Home > Backend Development > C#.Net Tutorial > What are the data types in c language

What are the data types in c language

下次还敢
Release: 2024-05-07 07:54:17
Original
1026 people have browsed it

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 byte
  • short int or short: two bytes
  • int: four bytes (32 bits)
  • long int or long: eight bytes (64 bits)

##Floating point type:

  • float: four bytes (single precision)
  • double: eight bytes (double precision)

Empty type:

  • void: Indicates no type

Character type:

  • char: Single character

Boolean type:

  • _Bool : Boolean value (true or false)

Others:

    ##size_t
  • : Size type (depends on the system)
  • ptrdiff_t
  • : Pointer difference type (depends on the system)
Integer type

The integer type is used to store integer values ​​(no decimal part). The size of the type depends on the system architecture.

Floating point type

The 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.

Empty type

void

Type means there is no type. It is used to return no value (void functions) or as a generic pointer type.

Character type

char

type is used to store a single character. It is also used in C language as a primitive type for strings.

Boolean type

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template