-6

what is the difference between Constant and Volatile

and

What is difference Volatile int i =10 And int i =10;

please let me briefly

8bitcat
  • 2,206
  • 5
  • 30
  • 59
user2787274
  • 13
  • 1
  • 4

1 Answers1

1

For a start

int i = 0;

Is not a constant, as it requires the const keyword. A constant cannot be modified and requires to be initialized (you can't put const int i; i = 10;)

Volatile [variables] can be modified externally, for example

asm volatile

Would state the the assembly code can be externally modified

Joseph
  • 589
  • 1
  • 5
  • 13