the variable is the name of the location which stores the value in c++. a variable is used to store value.

A variable is a data name that may be used to store data value.

A variable may take different values at different times during the execution of a program.

Variable names may consist of letters, digits, and underscore characters (_).

variable in cpp
data_type variable1, variable2 ;

Rules of variable :

The first character must be an alphabet or underscore.

Must consist of letters, digits, and underscore.

Cannot use a c++ keyword as a variable name. like int, float

Blank space is not allowed between variable name

Declaration of variable in c++ :

data_type v1, v2;

data_type: datatype is decide how data store in memory. like int, float

v1, v2 : v1 and v2 is name of variable


int evensum, oddsum
float radius

Assigning values of variable :

Values can be assigned to variables using the assignment operator = as follows:

variable_name = value
sum = 10


#include <iostream>
using namespace std;

int main() {
  int x = 5;
  int y = 6;
  int sum = x + y;
  cout << sum;
  return 0;