Co-qualifiers or access modifiers in C: const and volatile

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:

#include <stdio.h>

void dashes(const char *a);

int main(void)


dashes(“More Process”);

return 0;


void dashes(const char *a)


while(*a) {

if(*a== ‘ ‘) printf(“%c”, ‘-‘);

else printf(“%c”, *a);




Output: More-Process

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;

Leave a Reply