What is Variables?
Variables is used to hold any value
What is Constant?
A Constant is a value whose worth Never changes
Example:-
#include<iostream.h>;
#include<conio.h>;
class aptech
{
public:
constantexample()
{
const a=2;
cout<<a;
}
};
void main()
{
aptech ap;
clrscr();
ap.constantexample();
getch();
}
#include<conio.h>;
class aptech
{
public:
constantexample()
{
const a=2;
cout<<a;
}
};
void main()
{
aptech ap;
clrscr();
ap.constantexample();
getch();
}
What is Identifier?
The names of variables,functions,labels and various other user defined objects are called identifiers
What is Keywords?
All language reserve certain words for their internal use i.e keywords
Guidelines for Specifying Identifier Names
- Variable names must begin with an alphabet
- The first character may be followed by a sequence of letters or digits and can also include a special character like the underscore
- Avoid using the letter O in places where it can be confused with the number 0 and similarly the lowercase letter L can be mistaken for the number 1
- Proper name should be avoided while naming variables
- Typically, uppercase and lowercase letters are treated as diffrent i.e variable ADD,add,Add are all diffrent
- As case sensitivity consideration vary with programming languages it is advisable to maintain a standard way of naming variables
- A variable name should be meaningful and descriptive, it should describe the kind of data it holds.For example if the sum of two numbers is to be found,the variable storing the result may be called sum.Naming it s or ab12 is not a good idea
Data Types in C++


Basic and Derived Data Types in C++
- Signed:-Default integer declaration assume a signed number means it stores positive and negative both numbers
- Unsigned:-If we use Unsigned then variable only stores positive numbers and if we want to stores only positive numbers in variable then we will use %u