Why do we use the volatile keyword? [duplicate]
Consider this code, int some_int = 100; while(some_int == 100) { //your code } When this program gets compiled, the compiler may optimize this code, if it finds that the program never ever makes any attempt to change the value of some_int, so it may be tempted to optimize the while loop by changing it … Read more