Using the key word "const" in cpp

The const key word creates symbolic constants in Cpp. The values declared as const cannot be modified by the program in any way. So it is a way of declaring constants throughout the program.



The program


//using const data type

#include<conio.h>
#include<iostream.h>
const int q=10;    // const are global in nature.

void main()
{
const char w[q]="\nhello\n";
const char e='k';

clrscr();
cout<<q<<w<<e;

getch();
}

Popular posts from this blog

How to pass variables to res.render() in Node.js

Talky Messenger Documentation & Setup