Another const variable

 

Compiler: Visual C++ Express Edition 2005

Compiled on Platform: Windows XP Pro SP2

Header file: Standard

Additional project setting: Set project to be compiled as C++

Project -> your_project_name Properties -> Configuration Properties -> C/C++ -> Advanced -> Compiled As: Compiled as C++ Code (/TP)

Other info:

To do: Display a string

To show: Another const variable

 

 

// const variable

#include <iostream>

using namespace std;

 

const int ArrayOne = 64;

// The following code is legal in C++, but not in C

char StoreChar[ArrayOne] = "This is a test string!!!";

 

int main(void)

{

cout<<"The stored string is = "<<StoreChar<<"\n";

}

 

Output example:

 

The stored string is = This is a test string!!!

Press any key to continue . . .

 

 

C and C++ Programming Resources | C & C++ Code Example Index