Define Constants using const keyword - C Language Basics

C examples for Language Basics:Constant

Introduction

Constant data values can be of many data types but must be assigned when the constant is first created.

Demo Code

#include <stdio.h> 
int main()/*from  w  ww .j a  va2 s  .  c o  m*/
{ 
   const int x = 20; 
   const float PI = 3.14; 
   printf("\nConstant values are %d and %.2f\n", x, PI); 
}

Related Tutorials