- A variable is a name of the memory location. It is used to store data. Its value can be changed, and it can be reused many times.
- It is a way to represent memory location through symbol so that it can be easily identified.
- To manipulate memory address easily, we can attach a variable name to the memory address.
- So, it will be very easier to manipulate the memory address using a variable name rather than hexadecimal values.
- Datatype variable_name;
Rules for Defining a Variable
1. variable can have alphabets, digits, and underscore.
- valid: abc, ab1, _abc;
- valid: var, _value, name;
- Invalid: 1var, 23cr;
- Age and age is different variables.
- valid: abc, variable_name;
- Invalid: variable name, hel lo;
0 Comments