PDF

Data Type Introduction

Leave a Comment

Introduction


Every programming language deals with some data. For example to print any message it requires charter or string type of data. To solve any mathematics expression it requires integral as well as real number (floating type) of data. C is very rich in data type. We can broadly divide all data type in C in three categories : 

  1. Primitive or fundamental data type 
  2. Derived data type
  3. User defined data type

Built-in data types or primitive data types :


  1.  int
  2.  float
  3.  double
  4.  char
  5.  void

int - data type


int is used to define integer numbers.

{
int count;
Count = 5;
}


float - data type


float is used to define floating point numbers.

{
float Miles;
Miles = 4.6;
}


double - data type


double is used to define BIG floating point numbers.
It reserves twice the storage for the number. On PCs this is likely to be 8 bytes;

{
double Atoms;
Atoms = 25000000;
}


char - data type 


char defines characters.

{
char Letter;
Letter = 'a';
}

Derived data types available are 


  1.  array
  2.  pointers
  3.  functions


User defined data types


  1.  structure 
  2.  union
  3.  enumerations


Derived data types and User defined data types will be explained in next sessions.

0 comments:

Post a Comment