Our website is made possible by displaying online advertisements to our visitors.Please consider supporting us by disabling your ad blocker.
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Translate it in your own Language

Print this Job Post

Print Friendly and PDF

Thursday, May 1, 2014

Data Type

  • C data types are defined as the data storage format that a variable can store a data to perform a specific operation.
  • Data types are used to define a variable before to use in a program.
  • Size of variable, constant and array are determined by data types.
Integer data type:

  • Integer data type allows a variable to store numeric values.
  • int” keyword is used to refer integer data type.
  • The storage size of int data type is 2 or 4 or 8 byte.
  • It varies depend upon the processor in the CPU that we use. If we are using 16 bit processor, 2 byte (16 bit) of memory will be allocated for int data type.
  • Like wise, 4 byte (32 bit) of memory for 32 bit processor and 8 byte (64 bit) of memory for 64 bit processor is allocated for int datatype.
  • int (2 byte) can store values from -32,768 to +32,767
  • int (4 byte) can store values from -2,147,483,648 to +2,147,483,647.
  • If you want to use the integer value that crosses the above limit, you can go for “long int” and “long long int” for which the limits are very high.
  • Note:
  • We can’t store decimal values using int data type.
  • If we use int data type to store decimal values, decimal values will be truncated and we will get only whole number.
  • In this case, float data type can be used to store decimal values in a variable.

Character data type:

  • Character data type allows a variable to store only one character.
  • Storage size of character data type is 1. We can store only one character using character data type.
  • “char” keyword is used to refer character data type.
  • For example, ‘A’ can be stored using char datatype. You can’t store more than one character using char data type.
  • Please refer C – Strings topic to know how to store more than one characters in a variable.

Floating point data type:

Floating point data type consists of 2 types. They are,


  • float
  • double


1. float:

Float data type allows a variable to store decimal values.
Storage size of float data type is 4. This also varies depend upon the processor in the CPU as “int” data type.
We can use up-to 6 digits after decimal using float data type.
For example, 10.456789 can be stored in a variable using float data type.

2. double:

Double data type is also same as float data type which allows up-to 10 digits after decimal.
The range for double datatype is from 1E–37 to 1E+37.

No comments:

Post a Comment

Copyright @ CrackMNC 2014-2024
Divas Nikhra Theme by Crack MNC