To create a variable, specify the type and assign it a value:
Syntax
type variable_name = value;
|
Where type is one of C types (such as int), and variableName is the name of the variable (such as x or myName).
The equal sign is used to assign a value to the variable.
So, to create a variable that should store a number, look at the following example:
You can also declare a variable without assigning the value, and assign the value later:
Example:
//Declare a Variable
int My_num;
//Assign value to variable
My_num = 15;
|