DataType in C#

In my Previous Article's, I covered essential topics like

  1. Speech Translator in C#.NET
  2. Generate Barcode in C#.NET
  3. Create USER Control in C#.NET
  • Data is a Collection of Facts, a Facts may be member of character ( or ) a group of character.
  • Information is the processed data.

DATATYPE

DataType specifies the type of data that we stored in memory whenever we want to perform any operation on any data we need to store the data, in order to store the data we require some memory.
How much memory is required to store the data was decided by datatype.


What is Datatype in C#

Where the memory allocated for Data?

Ans.) RAM

VARIABLE

Variable is a name given by particular memory location.

Purpose of the VARIABLE

Purpose of the variable is to identify a particular memory location.

Syntax to declare a variable

datatype variablename;
int i;

What is BYTE?

byte is a datatype which will allocate 2 bytes of memory to store integer data.
The Range of byte : 0 to 255

What is Short?

Short is a datatype which will allocate 4 bytes of memory to store integer data.
The Range of byte : -32767 to +32768

What is Int?

Int is a datatype which will allocate 4 bytes of memory to store integer data.
The Range of byte : -10 digit no. to +10 digit no.

What is Long?

Long is a datatype which will allocate 8 bytes of memory to store integer data.
The Range of byte : -19 digit no. to +19 digit no.

What is float?

float is a datatype which will allocate 4 bytes of memory to store FloatingPoint.


  float f = 2.3  ( Wrong )
  float f = 2.3f ( Correct )

What is double?

double is a datatype which will allocate 8 bytes of memory to store FloatingPoint.


  double d = 2.3; ( Correct )

What is Decimal?

Decimal is a datatype which will allocate 16 bytes of memory to store FloatingPoint.


  decimal d = 234.56m;

What is Char?

Char is a datatype which will allocate 2 bytes of memory to store a Single Char.

What is string?

string is a datatype which will allocate memory to store group of Character's.


  string s = "abc"

Post a Comment

0 Comments