What is volatile

Answers were Sorted based on User's Feedback



What is volatile..

Answer / ravi.jnv

Volatile is to inform the compiler that not to optimise
code.
for ex:
int a = port1;
int b = port1;
int c = port1;

compiler may convert it as
int a=b=c=port1;

so avoid it , u have to use volatile keyword.

Is This Answer Correct ?    3 Yes 0 No

What is volatile..

Answer / nikhil

Basically, it is a type qualifier.
a volatile data type is used at optimizer level.
Generally, in the embedded coding, When the optimizer is Set
on "favor size". The data type declaration as volatile
declares to compiler that the value of this data type can
change beyond the program flow(like interrupts.
Otherwise if the optimizer is enable, the program malfunctions.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C Interview Questions

What is the output of the below program and how it is? void main() { static int var=5; printf("%d",var--); if(var) main(); }

8 Answers   MindFire, TCS, Tech Mahindra,


main() { char ch='356'; Printf("%d",ch); } *OUTPUT*:- -18 *Why?*

1 Answers  


explain about storage of union elements.

2 Answers   ABC, Bosch,


what is y value of the code if input x=10 y=5; if (x==10) else if(x==9) elae y=8; a.9 b.8 c.6 d.7

4 Answers   TCS,


What is the use of getchar() function?

0 Answers  






What is static and volatile in c?

0 Answers  


Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

0 Answers  


What is pointer & why it is used?

0 Answers  


Input is "Jack and jill went up a hill" To print output is 1-letter word(s)-1 2-letter words-1 3-letter words-1 4-letter words-4

1 Answers   Mind Tree, TCS,


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

2 Answers   Aricent, Manipal University,


Is javascript based on c?

0 Answers  


Is main an identifier in c?

0 Answers  


Categories