Assign Values to Variables
Once we declare a variable, we can assign a value to it. Let's see how to do that.
// declare the variable
int age;
// assign the data 25 to it
age = 25;
Here, we have used the =
operator to assign the value 25 to the age
variable.
Declare and Assign Value together
We can also assign values to variables during their declaration. Let's see how:
int age = 25;
Here, we have created a variable and assigned a value to it in a single statement.
