Loading, please wait...

MCQ

What are C# variables and data types | C# Tutorials

Nov 04, 2020 C#, CSharp, 635 Views
The memory location is usually done with the help of C#. The variable names are also called the identifiers. Declaring the identifiers have several rules for instance

What are C# variables and data types | C# Tutorials

The memory location is usually done with the help of C#. The variable names are also called the identifiers. Declaring the identifiers have several rules for instance

  • It should start with an alphabet or underscore
  • It can have numbers, letters, underscore
  • No spaces are allowed
  • The variable name should not be the same as some reserved words such as char, int, etc.

There are different types of variables to be categorized, such as decimal type, Boolean type, and more.

The variables are very useful and in co-relation with Data Types.

Data types are the format used by the variables to store some values in it. These values can vary widely from integer to string value.

There are three different types of Data types:

  1. Value data type: consisting of char, int, float, etc
  2. Reference data type: consisting of string, classes, objects, etc
  3. Pointer data type: consisting of pointers

All these data types have their own unique range and memory for the allocation of data, along with specified types of data to be allocated.

Example of some data types:

  • int for integer values
  • float for the floating-point numbers
  • double for the decimal digits
  • char for characters
  • bool for Boolean values like true false
  • pointers with address and pointer node

and many more.

MCQ

Related Article