Day 1 1
Day 1 1
Data types specify the type of data that a valid C# variable can hold. C# is a
strongly-typed language. It means we must declare the type of a variable that
indicates the kind of values it is going to store, such as integer, float, decimal,
text, etc.
1) Predefined Data Types: The memory size of data types according to 32 bit operating
system.
struct Coordinate
{
public int x;
public int y;
}
enum: enum (or enumeration type) is used to assign constant names to a
group of numeric integer values. It makes constant values more
readable, for example, WeekDays.Monday is more readable then number 0
when referring to the day in a week.
Example:
enum WeekDays
{
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
}
If the data is changed by one of the variables, the other variable automatically reflects
this change in value.
Declaring a pointer
The pointer in C# language can be declared using * (asterisk symbol).
1. int * a; //pointer to int
2. char * c; //pointer to char