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 use of volatile?

1 Answers  


write a c program to print the values in words eg:- 143 written it has (one hundred and forty three)& 104, 114 are also written words

5 Answers   Captronic, DELL, Google, IBM, Mithi, RCC, Wipro,


define c

6 Answers   HCL, TCS,


what is pointer ? what is the use of pointer?

6 Answers   Infosys,


What are the different types of data structures in c?

1 Answers  


what is the output of the code and how? main() { int *ptr,x; x=sizeof(ptr); printf("%d",x); }

1 Answers  


What's the difference between struct x1 { ... }; and typedef struct { ... } x2; ?

3 Answers  


what are the general concepts of c and c++

2 Answers  


How do shell structures work?

1 Answers  


What is volatile

2 Answers  


How we can insert comments in a c program?

1 Answers  


Difference between for loop and while loop?

1 Answers  


Categories