Data Types of C

Data Types in C

Data types in C can be broadly classified as follows :

A summary of all the data types in C

What is a Data type ?

Ans-In computer science and computer programming, a data type or simply type is an attribute of data which tells the compiler or interpreter how the programmer intends to use the data.
Common data types include:

What is a Primitive data type ?

Ans:-  Primitive type is a data type provided by a programming language as a basic building block. Primitive data types are predefined types of data, which are supported by the programming language. For example, integercharacter, and string are all primitive data types.


Some Classifications and more details of the Primitive data types are as follows :-

ExplanationFormat specifier
charSmallest addressable unit of the machine that can contain basic character set. It is an integer type. Actual type can be either signed or unsigned. It occpies 1 bits of space.%c
signed charOf the same size as char, but guaranteed to be signed. Capable of containing at least the [−127, +127] range.%c (or %hhi for numerical output)
unsigned charOf the same size as char, but guaranteed to be unsigned. Contains at least the [0, 255] range.%c (or %hhu for numerical output)
short
short int
signed short
signed short int
Short signed integer type. Capable of containing at least the [−32,767, +32,767] range. Thus, it is at least 16 bits in size. The negative value is −32767 (not −32768) due to the one's-complement and sign-magnitude representations allowed by the standard, though the two's-complement representation is much more common.%hi
unsigned short
unsigned short int
Short unsigned integer type. Contains at least the [0, 65,535] range.%hu
int
signed
signed int
Basic signed integer type. Capable of containing at least the [−32,767, +32,767] range.Thus, it is at least 16 bits in size.%i or %d
unsigned
unsigned int
Basic unsigned integer type. Contains at least the [0, 65,535] range.%u
long
long int
signed long
signed long int
Long signed integer type. Capable of containing at least the [−2,147,483,647, +2,147,483,647] range. Thus, it is at least 32 bits in size.%li
unsigned long
unsigned long int
Long unsigned integer type. Capable of containing at least the [0, 4,294,967,295] range.%lu
long long
long long int
signed long long
signed long long int
Long long signed integer type. Capable of containing at least the [−9,223,372,036,854,775,807, +9,223,372,036,854,775,807] range. Thus, it is at least 64 bits in size. Specified since the C99 version of the standard.%lli
unsigned long long
unsigned long long int
Long long unsigned integer type. Contains at least the [0, +18,446,744,073,709,551,615] range. Specified since the C99 version of the standard.%llu
floatReal floating-point type, usually referred to as a single-precision floating-point type. Actual properties unspecified (except minimum limits), however on most systems this is the IEEE 754 single-precision binary floating-point format (32 bits). This format is required by the optional Annex F "IEC 60559 floating-point arithmetic".Converting from text:
  • %f %F
  • %g %G
  • %e %E
  • %a %A
doubleReal floating-point type, usually referred to as a double-precision floating-point type. Actual properties unspecified (except minimum limits), however on most systems this is the IEEE 754 double-precision binary floating-point format (64 bits). This format is required by the optional Annex F "IEC 60559 floating-point arithmetic".
  • %lf 

long doubleReal floating-point type, usually mapped to an extended precision floating-point number format. Actual properties unspecified. It can be either x86 extended-precision floating-point format (80 bits, but typically 96 bits or 128 bits in memory with padding bytes), the non-IEEE "double-double" (128 bits), IEEE 754 quadruple-precision floating-point format (128 bits), or the same as double. See the article on long double for details.%Lf 

What is a Derived Data type ?

Ans :- 

Comments

Popular posts from this blog

Bubble Sort ( C & Python 3)

Comparison Logical and Bitwise Operator ( Java Part - 4 )

Something about me