
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
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
- Related Articles
- Explain the Difference Between Definition and Declaration
- What is the difference between a definition and a declaration in C++?
- Difference between Definition and Declaration in Java.
- Dying Declaration: Meaning and Definition
- Internal Table itab declaration in SAP and difference between both the declarations
- What is the difference between $ and @ in R?
- What is the difference between == and === in JavaScript?
- Difference Between HQ (High Quality) and HD (High Definition)
- What is the difference between /* */ and /** */ comments in Java?
- What is the difference between NA and in R?
- What is the difference between | and || operators in c#?
- What is the difference between >> and >>> operators in Java?
- What is the difference between comments /*...*/ and /**...*/ in JavaScript?
- What is the difference between = and == operators in Python?
- What is the proper declaration of main in C++?

Advertisements