Volatile (computer programming): Difference between revisions

Content deleted Content added
Wikilinks and example added
What can happen if volatile is not used?: Remove bugs from example code
Line 6:
 
<pre><nowiki>
intvoid foo(void)
{
int *addr = 100;
addr = 100;
*addr = 0;
 
while (*addr != 1)
Line 21 ⟶ 22:
 
<pre><nowiki>
intvoid foo(void)
{
int *addr = 100;
addr = 100;
*addr = 0;
 
while (1)
Line 38 ⟶ 40:
 
<pre><nowiki>
intvoid foo(void)
{
volatile int *addr = 100;
addr = 100;
*addr = 0;
 
while (*addr != 1)