---
title: "What are volatile variables?"  
description: "What are volatile variables?"  
author: "Prakash nidhi Verma"  
published: 2018-07-10  
updated: 2020-09-22  
canonical: https://www.mindstick.com/interview/23465/what-are-volatile-variables  
category: "c#"  
tags: ["c#", "education"]  
reading_time: 1 minute  

---

# What are volatile variables?

volatile variables :

Volatile variables are same like other variables but there are values might be changed at any given point only by some external resources.

syntax:

```
volatile int number;
```

volatile variables are qualifiers that show us that value of the variables can be change at any time in the code source.The value may be discard by some external factor, if it does't appear to the left of the given statement.volatile variables stored in the compiler.

example:-

```
volatile int n;
```

## Answers

### Answer by Prakash nidhi Verma

volatile variables :

Volatile variables are same like other variables but there are values might be changed at any given point only by some external resources.

syntax:

```
volatile int number;
```

volatile variables are qualifiers that show us that value of the variables can be change at any time in the code source.The value may be discard by some external factor, if it does't appear to the left of the given statement.volatile variables stored in the compiler.

example:-

```
volatile int n;
```


---

Original Source: https://www.mindstick.com/interview/23465/what-are-volatile-variables

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
