---
title: "What is the difference between declaration and definition?"  
description: "What is the difference between declaration and definition?"  
author: "Anonymous User"  
published: 2015-01-15  
updated: 2020-09-16  
canonical: https://www.mindstick.com/interview/2267/what-is-the-difference-between-declaration-and-definition  
category: "oops"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# What is the difference between declaration and definition?

**Difference between declaration and definition**\
\
**A declaration** introduces an identifier and describes its type, be it a type, object, or function. A declaration is what the compiler needs to accept references to that identifier.\
**A definition actually** instantiates/implements this identifier. It's what the linker needs in order to link references to those entities. \
**The declaration tells** the compiler that at some later point we plan to present the definition of this declaration.\
**E.g.:**

```
 void stars () //function declaration 		The definition contains the actual implementation.		E.g.: void stars () // declarator{		for(int j=10; j > =0; j--) //function body		cout << *;		cout << endl; }
```

## Answers

### Answer by Anonymous User

**Difference between declaration and definition**\
\
**A declaration** introduces an identifier and describes its type, be it a type, object, or function. A declaration is what the compiler needs to accept references to that identifier.\
**A definition actually** instantiates/implements this identifier. It's what the linker needs in order to link references to those entities. \
**The declaration tells** the compiler that at some later point we plan to present the definition of this declaration.\
**E.g.:**

```
 void stars () //function declaration 		The definition contains the actual implementation.		E.g.: void stars () // declarator{		for(int j=10; j > =0; j--) //function body		cout << *;		cout << endl; }
```


---

Original Source: https://www.mindstick.com/interview/2267/what-is-the-difference-between-declaration-and-definition

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
