Am looking for a clear explanation with example to differentiate between global and volatile variables. This was part of an interview question where the guy asked:
consider two programs: 1.c 2.c, where:
1.c: int a=10;
2.c: extern int a; printf(a);
Now, the value should be 10 only. Also, in case later if the value for a is changed in 1.c program then also 2.c will print the same value. Then how does volatile different from global variables?
Thanks for your answers. Not sure if the question is described clearly, let me know if any doubts.