In the last lesson, you saw how to set up the C# environment and how to install your first C# program. In this lesson, you will study the concept of data types and variables in C#. A variable is basically placeholder that is used to store data of a particular data type. A variable points to the memory location where the actual data is stored.
C# datatypes can be broadly categorized into four types:
Numeric Data Type
Numeric data types in C# are used to store numeric data. The following table shows commonly used numeric data types supported by C#:
|Data Type||Default Value||Size|
|signed int||0||4 byte|
|unsigned int||0||4 byte|
|signed long||0||8 byte|
|unsigned long||0||8 byte|
Let’s now see a very simple example that uses some of these numeric operators:
The boolean data type is used to store boolean data. In C#, the word “bool” is used to store boolean data. A “bool” type variable can have two values: True or False. The following example will further clear the use of boolean variable.