
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Declare Variables in C#
Each variable in C# has a specific type, which determines the size and layout of the variable's memory the range of values that can be stored within that memory and the set of operations that can be applied to the variable.
To declare variables −
<data_type> <variable_list>;
Let us see an example to declare two integer variables −
int a, b;
Above the variable is of int type. Let us declare a variable for other types −
Variable of float type.
float f;
Variable of double type.
double d;
Let us display a variable −
Example
using System; using System.Collections; class Demo { static void Main() { int x = 50; Console.WriteLine("Integer variable:"+x); } }
Output
Integer variable:50
Advertisements