Demonstrating the const type qualifier : const « Language Basics « C++ Tutorial






#include <iostream>
using std::cout;
using std::endl;

void f( const int [] );

int main()
{
   int a[] = { 10, 20, 30 };

   f( a );
   cout << a[ 0 ] << ' ' << a[ 1 ] << ' ' << a[ 2 ] << '\n';

   return 0;
}

void f( const int b[] )
{
   cout << b[ 0 ]; 
}
1010 20 30








1.8.const
1.8.1.Define constant
1.8.2.Demonstrates constants
1.8.3.const double value
1.8.4.Using a properly initialized constant variable.
1.8.5.Same Program Using Constant Integers
1.8.6.Demonstrating the const type qualifier