C language basics - basic data types and keywords

"The data type determines the size of the data storage space, expression method, data value range and operation method." 

Table of contents

Basic data types

        Integer data

        real data

        Character data

        string data


Basic data types

        Integer data

In C language, integer data is divided into three categories: basic integer (int), short integer (short) and long integer (long).

Integer data classification
type type identifier byte Ranges
Signed basic shaping [signed] int 4 -2147483648~2147483647
unsigned basic shaping unsigned int 4 0~4294967295
signed short [signed] short 2 -32768~32767
unsigned short unsigned short 2 0~65535
signed long integer [signed] long 4 -2147483648~2147483647
unsigned long integer unsigned long 4 0~4294967295

        Note: "[]" in the table is an optional part, and the content in "[]" can be omitted when writing.

        real data

        Real data is also called floating point data. In C language, execution data is divided into three types: single precision type (float), double precision type (double) and long double precision type (long double). All real data are signed data and there is no unsigned data.

Classification of real data
type type identifier byte Numeric range decimal precision
Single precision type float 4 3.4*10^{-38}~3.4*10^{38} 7 bits
Double type double 8 1.7*10^{-308}~1.7*10^{308} 15 people
long double long double 8 3.4*10^{-4932}~3.4*10^{4932} 19th place

        Character data

        Character data is divided into character type (char) and unsigned character type (unsigned char).

Classification of character data
type type identifier byte Ranges
Character type char 1 -128~127
unsigned char type unsigned char 1 0~255

        string data

        In the C language, there is no such type of string data. Generally speaking, we use character arrays (char []) to represent string data.

Guess you like

Origin blog.csdn.net/m0_74436212/article/details/131251066