Professional Documents
Culture Documents
Data Types
A programming language is designed to
manipulate certain kinds of data
consisting of numbers, characters and
strings provides useful output known as
information to the user.
The smallest non-reducible, textual
elements in a program are referred as
tokens.
Keywords
Identifiers
Literals
Operators and Punctuators.
Empty Statements
Labeled Statements
Declaration Statements
Expression Statements
Selection Statements
Interaction Statements
Jump Statements
Try Statements
The Checked Statements
The unchecked Statements
The lock Statements
The using Statements
Real Literals
Integer literals are inadequate to
represent
quantities
that
vary
continuously such as distances, heights,
temperatures, prices and so on.
These quantities are represented by
numbers containing fractional parts like
17.548 Such numbers are called real(or
floating point) numbers. The examples
are 0.083, -0.75 etc
String Literal
It is a sequence of characters enclosed
between double quotes. The characters
may be alphabets, digits and special
characters.
Ex: Hello C#, 20001
Backslash character literal
C# supports some special character
constants that are used in output methods.
The character combinations are called
escape sequences.
Variable
A variable is a identifier that denotes a
storage location used to store a value.
Unlike
constants
that
remain
unchanged during execution of a
program, a variable may take different
values at different times of execution.
Every variable has a type that
determines what values can be stored
in the variable.
Data Types
Every Variable in C# is associated with
data type.
Data type will specify a size and type
of values that can be stored in C#.
C# language is rich in data types.
The types in C# are primarily divided
into two categories.
a. Value Types b. Reference Types
and
A
using expression
const int m=10;
const int n=m*5;
We cannot use non-const values in
expressions.
For instance,
int m=10;
const int =m*5;
will result an error.
Static Variables
Instance Variables
Array elements
Value Parameters
Reference Parameters
Output Parameters
Local Variables.
m is a static variable
n as instance Variable
a[0] as array element
x as value Parameter
y is a reference Parameter
z as output Parameter
j as local Variables.
the