Mega Code Archive

 
Categories / C++ Tutorial / Language Basics
 

Demonstrating the const type qualifier

#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