- 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
What is the difference between declaration and definition in C#?
Declaration means that variable is only declared and memory is allocated, but no value is set.
However, definition means the variables has been initialized.
The same works for variables, arrays, collections, etc.
Variables
Declaring a variable.
int x;
Let’s define and assign a value.
x = 10;
Arrays
Declaring an array.
int [] n // declaring int n= new int[10]; // initializing
Let’s assign a value.
n[0] = 100; n[1] = 200
Advertisements