what is volatile in c language?

Answer Posted / selvakumar vedhachalam

It is nothing but telling to compiler that this variable
will change its value at anytime by means of anything and
compiler should not make any assumption about this variable.

Normally compiler will assume that some variable will be
constant during runtime. This may lead error in checking a
registor value repeatedly. Because the register value may
be changed by anything. So for these kind of variables
should be declared 'volatile' and it be checked each time
appears in the code with out any assumption.

Is This Answer Correct ?    135 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is string constants?

649


struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer

746


What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file

649


Find duplicates in a file containing 6 digit number (like uid) in O (n) time.

2574


a value that does not change during program execution a) variabe b) argument c) parameter d) none

678






What the advantages of using Unions?

661


Tell me the use of bit field in c language?

612


Do character constants represent numerical values?

831


What does the c preprocessor do?

607


One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.

2141


Why is void main used?

602


why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above

598


What is the benefit of using #define to declare a constant?

593


Write a program with dynamically allocation of variable.

591


Do array subscripts always start with zero?

764