The const keyword defines a variable who’s value cannot be changed.
const int num = 10;
Below is the C program to demonstrate the const keyword:
#include <stdio.h>
int main() {
const int a = 11;
a = a + 2;
printf("%d", a);
return 0;
}
Output:
error: assignment of read-only variable 'a'
a = a + 2;