Constants

Using const prefix, in the form: const data type identifier = value ;

 

#include <stdio.h>
int main()
{
   const int  HEIGHT = 20;
   const int  WIDTH  = 4;
   int area;

   area = HEIGHT * WIDTH;
   printf("value of area : %d", area);

   return 0;
}

Compile & run:

value of area : 80

 

Good practice to define a constant's identifier in UPPERCASE

Leave a Reply