top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Can a variable be both constant and volatile? [CLOSED]

+4 votes
391 views
Can a variable be both constant and volatile? [CLOSED]
This question has an answer at: What is use of const volatile ?
posted Nov 17, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Answering again here

Answer is Yes. The const modifier means that this code cannot change the value of the variable, volatile still means that compiler cannot optimize or reorder. Both can appear in any order i.e. constant volatile or volatile constant.

answer Nov 17, 2013 by Salil Agrawal
...