Modification of variables is controlled by access modifiers. There are two access modifiers in C: const and volatile.
const: In a program the constant variable is not changed and it is placed in the ROM. Example:
const int x = 1;
Here x is not modified in the rest of the program.
Use of const to print dashes in between the given text:
void dashes(const char *a);
void dashes(const char *a)
if(*a== ‘ ‘) printf(“%c”, ‘-‘);
else printf(“%c”, *a);
const is also used in the parameter declarations in standard library.
volatile: volatile makes the changing of values possible of a variable in ways not exactly defined by the program. It is used to maintain the order of evaluation of an expression. For Example:
volatile int x = 1;