#include <stdio.h>

int main() {
    // declare two const-qualified variables.
    const int x = 10, y = 20;

    // declare a pointer to the const-qualified variable x
    const int *p = &x;

    // print the value of a through x.
    printf("The value of x is %d\n", *p);

    // modifying x through p is not allowed.
    // *p = 20;    // wrong!

    // however, you can modify p, and make it point to
    // another const-qualified variable.
    p = &y;

    // print the value of y through x.
    printf("The value of y is %d\n", *p);

    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: