Data Types

0 shirleybedard5 November 25, 2020

These are the types of data that the variable can hold. For example, data 10 and 100.5 are the data of different types. Data 10 is an integer number(i.e whole number) while 100.5 is a fractional number. There are other varieties of data types supported by the C Programming, each of which may be represented differently within the computer’s memory. the variety f data type available allows the programmer to select the type needed by the application. 

Data Types in C++
Data Types in C Programming

Basically, Data types have three classes.

  • Primary data types
  • User-defined data types
  • Derived data types

Primary Data Types:

Primary Data types are categorized into five types:

  • int: Variables that hold an integer value
int code_help_pro = 100;
  • char: hold characters such as ‘A’, ‘b’, ‘V’
char code_help_pro = 'Y';
  • bool: Store a boolean value i.e true or false
bool code_help_pro = true;
  • double: hold a double-precision floating-point value
double code_help_pro = 100.9999;
  • float: Store double-precision floating-point value
float code_help_pro = 100.3;
Data TypeCategoryRangeMemory Space (Byte)
Integerint short signed short unsigned signed unsigned long signed long unsigned-32768 to +32767 -32768 to +32767 0 to 65535 -32768 to +32767 0 to 65535 -2147483648 to 2147483647 0 to 42949672952 2 2 2 2 4 4
Floatfloat3.4 X 10-38 to 3.4 X 10+384
doubledouble long double1.7 X 10-308 to 1.7 X 10+308 3.4 X 10-4932 to 1.1 X 10+49328 10
charsigned char unsigned char-128 to +127 0 to 2551 1

User-defined Data Types:

User-defined data types are categorized into three types in C Programming:

  1. struct
  2. union
  3. enum

We will cover User-defined data types in the next chapter. In this topic, Just remember that, These fall under User-defined data types.

Derived Data Types:

Derived data types are categorized into three types in C Programming:

  1. Array
  2. Function
  3. Pointer

We will cover Derived data types in the next chapter. These are huge topics in C Programming. In this topic, Just remember that, These fall under User-defined data types.