Skip to main content

Data Types

Datatype defines the type of value which we store in the variable. 
They are a means to define the type of data and associated operation of handling it.

There are 3 major data types:

Fundamental Datatype :

The datatypes which are not composed of other datatype are called as fundamental datatypes.
Example:
  • Integer
  • Character
  • Floating Point
  • Double Floating Point
  • Boolean
  • Void

Derived Datatype

The datatypes derived from the fundamental datatypes are called as derived datatypes.
Example:
  • Function
  • Array
  • Pointer
  • Reference

User-defined Datatype

These are defined by the user itself.
Example:
  • Class
  • Structure
  • Union
  • Enumeration
  • Typedef
enum (enumeration)
Enumerated means that all values are listed.
Example : 
Instead of writing 3 integer constants separately like :
const int START = 0;
const int PAUSE = 1;
const int GO = 2;
We can write :
enum { START, PAUSE, GO} ;

enum week_days { sun, mon, tue, wed, thur, fri, sat } ;
                                0      1       2     3       4     5    6

Comments

Popular posts from this blog

Data Representation

 Digital Number System In digital representation, various number systems are used. The most common ones are : Binary : base 2 (0, 1) Octal : base 8 (0, 1, 2, 3, 4, 5, 6, 7) Decimal : base 10 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) Hexadecimal : base 16 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F) Number Conversions : From Decimal to any system (base) (Decimal) 10 = (Any) base