answersLogoWhite

0


Best Answer

In languages like C, declaring a variable "volatile" tells the compiler that it can't assume that the variable is only changed by the program code. If the variable is not declared volatile, sometimes the compiler can make certain optimizations since it can assume that it knows everything about how the variable will be used. When it is declared volatile, the variable may be changed by an external process (for example, it could be connected to an I/O device), so it must always be fetched from memory.

For a better explanation, see the related links.

User Avatar

Wiki User

16y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is main difference between declaring variable and volatile variable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Difference between declaring a variable and definition a variable?

Declaration is a promise: 'I will define (or has defined) this variable/function somewhere else'.


What is the difference between a global variable and a private variable?

The accessibility. The global one: almost everywhere in the code may reference to the global variable directly. The private variable, is private to the declaring module (class, method, assembly) only. Outside of that module has no access to it directly.


The difference between fixed and variable inputs?

difference between fixed and variable inputs


What is the difference between declaring static variable as local and global?

There are two ways to declare varibles. 1. Locally 2. Globally When you declare a variable locally in any function that means it is only accessible by that function. When you declare a variable globally so it is accessible by all the functions in the program. Declaring variables with static keyword means you are setting its value null.


Difference between variable resistor and rheostat?

The difference between a variable resistor and a rheostat is the same as the difference between six and half a dozen.


What the difference between a variable and control?

The difference between a controlled variable and a variable is in their state. A controlled variable is something which is rigid and constant while a variable is liable to change and inconsistent.


WAP to show the difference between a variable and static variable?

difference between constant and static variables in java


What is the difference between a variable being tested and a variable being controlled?

The difference between these both is that the control is what stays the same in an experiment and the variable is what changes.


What is the difference between Declaration and Assignment?

Declaration is basically defining data type and length and assignment is to assign the value. Below is the declaration -- var a integer /* this means we are declaring a variable a as integer data type */ a= 5 /* this is assignment,we are assigning 5 to variable a */


What is one difference between a variable and a numerical expression?

The variable.


What is the difference between fix and variable mortgages?

The difference between fixed and variable mortgages are that in a fixed mortgage, the rate can not change. In a variable mortgage, the rate changes with time.


In oops what is the difference between class variable and variable?

Class Variable is a subset of Variables.