Solution for Exercise 6-15

ex0615

#include <stdio.h>

int main()
{
    const int v = 3;

    printf("The value is %d\n",v);
    printf("And %d is the value\n",v);
    printf("It's not %d\n",v+1);
    printf("And it's not %d\n",v-1);
    printf("No, the value is %d\n",v);
    return(0);
}

Output

The value is 3
And 3 is the value
It's not 4
And it's not 2
No, the value is 3

Notes

* You can get into trouble when you misspell your constant, although the compiler is very good about pointing out such errors.