DATA TYPES IN C#:-
C# provides various built =-in data types. Built-in data
types are the predefined data types.
The following table lists some f the built-in data types.
S.NO
|
data type
|
RANGE
|
1
|
byte
|
0 TO 255
|
2
|
sbtype
|
-128 TO 127
|
3
|
short
|
-32,768 TO 32,767
|
4
|
ushort
|
0 TO 65535
|
5
|
int
|
-2,147,483,648 to 2,147,483,648
|
6
|
uint
|
0 to 4,294,967,295
|
7
|
long
|
-9,223,372,036,854,775,808 to
9,223,372,036,854,775,808
|
8
|
ulong
|
0 to 18,446,744,073,709,551,615
|
9
|
float
|
-3.402823e38 to 2823e38
|
10
|
double
|
-1.79769313486232e308 to 76931386232e308
|
11
|
decimal
|
-792281625142643375593543950335 to
8162514264337593543950335
|
12
|
char
|
A Unicode
Character
|
13
|
string
|
A string of Unicode characters
|
14
|
bool
|
True or false
|
15
|
object
|
An object
|
NOTE:-Built-in data types are represented at the machine level. The
storage requirement, therefore, depends on the hardware. The #Bytes column in
the preceding table depicts the bytes required to store the value in the
memory.
c# also provides user-defined data types. You will learn
about user-defined data types in subsequent chapters.
TYPES OF DATA TYPES:-
C# supports two types of data types. The types of data types
supported by c# are:-
1.)
VALUE TYPES:- They directly contain data. Some
examples of the value types are char, int, and float, which can be used for
storing alphabets, integers, and floating point number, respectively. When you
declare an int variable, the system allocates memory to store the value. The
following figure shows the memory allocation of an int variables.
2.)
REFERENCE TYPES:- The reference types do not
maintain data but they contain a reference to the variable. Which are stored in
memory. Using more than one variable, you can use the reference types to refer
to a memory location. This means that if the value in the memory location is
modified by one of the variables, the other variables automatically reflect the
changed value. The example of a references type is string data type.
The above figure shows the memory allocation of a string
value “HELLO” in a variable named Str.
Previous post:- VARIABLE DECLARATION IN C#
Next post:-
NOTE:- PLEASE POST YOUR QUARRIES IN COMMENT BOX FOR US
0 comments:
Post a Comment