Can you have constant volatile variables?



Can you have constant volatile variables?..

Answer / Vikash Shukla

"Yes, a variable can be both const and volatile in C. The const keyword indicates that the value of the variable should not be changed, while the volatile keyword indicates that the variable's value may be modified by hardware or other external factors outside of the program's control. In such cases, the compiler is instructed to avoid optimizations that might rely on the assumption that the variable's value does not change."

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Embedded Systems AllOther Interview Questions

what is embedded system in a computer system?

1 Answers  


What is meant by a sandbox, why you would use one.

1 Answers  


Tell me can a variable be both const and volatile?

1 Answers  


Explain what is return type of isr?

1 Answers  


Discuss the concept of yagni and explain something you did recently that adhered to this practice.

1 Answers  


What are the functional requirements that are used in the embedded systems?

1 Answers  


What is the purpose of the segment register?

1 Answers  


Tell me what are the different types of customizations that is used with the “volatile” keyword?

1 Answers  


Write a constant time consuming statement lot finding out if a given number is a power of 2?

1 Answers  


What is size of character, integer, integer pointer, character pointer?

1 Answers  


Tell us what is the need for an infinite loop in embedded systems?

1 Answers  


What is a 'const' variable?

1 Answers  


Categories