data type

Download Data Type

If you can't read please download the document

Upload: kamal-tiwari

Post on 28-Jan-2016

212 views

Category:

Documents


0 download

DESCRIPTION

C# Datatypes

TRANSCRIPT

PRIMITIVE DATA TYPES IN C#int => 4 bytes For Integer Values =2^32uint => Unsigned 4 bytes For Integer ValuesByte => 1 byte (0-255) =>2^8Sbyte => Signed 1 byteshort => Signed 2 bytes for integer values =>2^16ushort => Unsigned Signed 2 bytes for integer values long => Signed 8 bytes for Integer Values ulong => Unsigned 8 bytes for Integer Values Float => 4 bytes Decimal ValueDecimal => 8 Bytes Decimal ValueDouble => 8 bytes Decimal valuechar => 2 bytes Characterstring => 2 bytes per character in stringbool =>Boolean values True/Falsevar => it has no specific datatypes. Whatever value we assign to the Var, its datatype changes accordinglyeg: var x=10; X is of int type var x="hi"; x is of string type---------------------------------------------------//Array = Continous memory allocations of same type of data //1-D Array int[] a = new int[5]; Console.WriteLine("Enter 5 nos"); for (int i = 0; i = 0; i--) { Console.WriteLine(a[i]); } Console.ReadKey();----------------------------------------------------int[] a = new int[5]; Console.WriteLine("Enter 5 nos"); for (int i = 0; i