volatile means value of variable may be change at anytime
In example, compiler know that foo is set to 0 and compiler will never look into while loop but by external even when foo become 1 then compiler will execute statement
When we should avoid use of volatile variable in program?Code:int foo
void bar ()
{
foo = 0;
while (foo = 1)
{
statement
}
}