![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# Multiple Local Variable Declarations
In C#, you can use the comma to declare more than one local variable in a statement. The following displays the same −
int a = 20, b = 70, c = 40, d = 90;
Example
Let us see an example in which we are declaring multiple local variables. Below four variable is declared and initialized in the same statement.
using System; class Demo { static void Main() { int a = 20, b = 70, c = 40, d = 90; Console.WriteLine("{0} {1} {2} {3}", a, b, c, d); } }
Output
20 70 40 90
Advertisements