In any iteration process... when initializing a variable ..if you put the value to be beyond 1000's then the output changes no?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In any iteration process... when initializing a variable ..if you put the value to be beyond 1000's then the output changes no??

2nd Nov 2016, 6:07 AM
Karan Jain
Karan Jain - avatar
11 Answers
+ 1
try it yourself...input a bigger number in a program and see the output.
3rd Nov 2016, 4:29 AM
Karan Jain
Karan Jain - avatar
+ 1
I was saying that when I try out one simple program to print a number with some conditions then the output changes the number...... conditions I put are not affecting the input number..
5th Nov 2016, 10:43 AM
Karan Jain
Karan Jain - avatar
+ 1
yeah but you try this int a=10000000000000000000000 and then print number changes??
5th Nov 2016, 11:00 AM
Karan Jain
Karan Jain - avatar
+ 1
just try it in your text editor
5th Nov 2016, 11:04 AM
Karan Jain
Karan Jain - avatar
+ 1
yes I know I just tried a big number and just asked about my doubt with the output thats it...anyway thanks
5th Nov 2016, 11:07 AM
Karan Jain
Karan Jain - avatar
0
Well, in what way do you think it will change?
2nd Nov 2016, 7:32 AM
Bart Genuit
Bart Genuit - avatar
0
Well, if I put a bigger number, that bigger number comes out, indeed. http://www.sololearn.com/app/sololearn/playground/c9v90Q79XGMZ/
3rd Nov 2016, 7:31 AM
Bart Genuit
Bart Genuit - avatar
0
But what was your question?
3rd Nov 2016, 7:32 AM
Bart Genuit
Bart Genuit - avatar
0
Okay, I think that depends on the type of variable you use to store that number. If you use value types, the original will not change if you put a=3, b=a, b=5. But if you're using reference (aka handle) types, the variables do not store the number itself, but a reference to that number. So when you change the variable, you change the number that is referred to (from multiple different variables). Does that make sense?
5th Nov 2016, 10:54 AM
Bart Genuit
Bart Genuit - avatar
0
No, why would it change?
5th Nov 2016, 11:03 AM
Bart Genuit
Bart Genuit - avatar
0
I don't understand why it has to be a big number, do you mean at some point the variable overflows?
5th Nov 2016, 11:04 AM
Bart Genuit
Bart Genuit - avatar