in Technology by
What is a volatile variable in C?

1 Answer

0 votes
by

The volatile keyword is a type qualifier that prevents the objects from the compiler optimization. According to C standard, an object that has volatile-qualified type may be modified in ways unknown to the implementation or have other unknown side effects. You can also say that the value of the volatile-qualified object can be changed at any time without any action being taken by the code.

If an object is qualified by the volatile qualifier, the compiler reloads the value from memory each time it is accessed by the program that means it prevents from cache a variable into a register. Reading the value from memory is the only way to check the unpredictable change of the value.

Related questions

0 votes
    Can we declare a variable be both constant and volatile in C?...
asked Jan 23, 2021 by JackTerrance
0 votes
    What is a volatile variable and there purpose n Java?...
asked May 19, 2021 in Technology by JackTerrance
0 votes
    The type of a variable that is volatile is _______________ (a) Volatile variable (b) Mutable variable (c) ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    Can we have a volatile pointer?...
asked Jan 22, 2021 in Technology by JackTerrance
0 votes
    An aqueous solution of 2 per cent (wt./wt) non-volatile solute exerts a pressure of 1.004 bar at the boiling ... mass of the solute? Select the correct answer from above options...
asked Jan 5, 2022 in Education by JackTerrance
0 votes
    Calculate the mass of a non-volatile solute ( molecular mass 40 ) which should be dissolved in 114g octane to ... pressure to 80% . Select the correct answer from above options...
asked Jan 5, 2022 in Education by JackTerrance
0 votes
    A solution containing 30g of a non-volatile solute exactly in 90g water has a vapour pressure of 2.8kPa at 298K. ... of water at 298K. Select the correct answer from above options...
asked Jan 5, 2022 in Education by JackTerrance
0 votes
    Why vapour pressure of a liquid decreases when a non- volatile solute is added to it ? Select the correct answer from above options...
asked Jan 5, 2022 in Education by JackTerrance
0 votes
    You can restrict the entry of data into a field by defining a for it a calculated values b volatile rule c. validation rule Select the correct answer from above options...
asked Dec 25, 2021 in Education by JackTerrance
0 votes
    1. Primary memory is called memory. 2. The full form of OMR is 3. Secondary memory of a computer is also ... 5 memory is volatile. Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
0 votes
    which of the following statement is false a secondary storage of non-volatile B primary storage is volatile C when ... of the above Select the correct answer from above options...
asked Dec 10, 2021 in Education by JackTerrance
0 votes
    Pick out the odd one * 1)Byte 2)Tera Byte 3)Volatile Memory 4)Zetta Byte Select the correct answer from above options...
asked Dec 1, 2021 in Education by JackTerrance
0 votes
    The magnetic storage chip used to provide non-volatile direct access storage of data and that have no moving ... Storage topic in portion Recovery System of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    Non-volatile storage needs to have a _________ where the loses in future can be recovered. (a) Dump ... Nonvolatile Storage topic in section Recovery System of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    Can we have a volatile pointer?...
asked Jan 23, 2021 by JackTerrance
...