C Programming Reference >> C Basic Tutorials >> C Keywords Home >> consti 30/12/06 - Views - Ratings : This used to declare a variable constant. This means that the value of variable is unchangable. It can also be used to declare a pointer constant in that case value pointed by that pointer is unchangable. This specially desirable when we want the value passed by refrence to a function remain unchanged under all circumstances. Code - void function (void)
{
const int a = 10;
printf ("%d",a);
\\ a = 20; If you remove the comments symbol this will generate an compile time error.
}
|