<< variables and the use in a code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

<< variables and the use in a code

declaring

18th Nov 2016, 5:10 AM
Demaya Montecristo
Demaya Montecristo - avatar
4 Answers
0
please make your questions understandable
18th Nov 2016, 6:38 AM
Rill Chritty
Rill Chritty - avatar
0
explain your question please
18th Nov 2016, 7:03 AM
Rill Chritty
Rill Chritty - avatar
0
if you mean 'what are variables?', variables are just like named placeholders for values of their type. they must be declared with a name and their type specified. for instance 'int myNumber' is a variable of type 'integer' and name 'myNumber' - this means that this variable can take any integer as its value, for example -2, -7, 0, 3, 100, etc. you can always change the value of a variable by using the assignment operator (=), for example myNumber = 6;. You can assign a value to a variable in its declaration, for example, char letter = 'A';. Note that constant variables (variables declared with keyword 'const') cannot be changed, once assigned, for example, const int var = 12;
18th Nov 2016, 7:12 AM
Rill Chritty
Rill Chritty - avatar
0
in the above post, i meant to write '... you can always change the value of a variable by using the assignment operator (=)...'****
18th Nov 2016, 7:16 AM
Rill Chritty
Rill Chritty - avatar