+ 2
What is the different between variable & constant?
I am confusing about variable & constant please explain it.
9 Answers
+ 6
constant means a value that never changes
for example if you create a constant variable a and assign it with 10.....
then you can't change value of a.....
but if you create a simple variable a and assign it with 10.....
you are free to change it's value any time in the program. đ
+ 2
Constant = Always its value is fixed.
Variable = Its value changes when condition / conditions is / are changed.
+ 2
constant which does not change their state and value e.g=1,2,3
where 1 is constant it can not change his value like 1=2 it's wrong.
variable which can change their value means they contain some value like y=2
and y can change his value like
y=6,y=8 and so on.
0
thnks
0
Constant ="Values that do not change" eg. 10,1.5,"a"
Variable =."sort of a container to contain constants" eg. x=10
0
variables value can be changed anywhere u want in the program.. but constant once declared and initialized will have the same value even if u try to change it anywhere in the program..
0
constant = fixed value
variable = value changes over time
0
@dAisy, time itself is a variable.
0
constant variable has its fix value and that is initialized at the time of declaration , later we can not change that value. If we do so that will cause an error.
Variables value can be changed any where in program.