What if I assign a huge number to a variable? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What if I assign a huge number to a variable?

what will happen if I assign a huge number to a variable, in running the code will it not harm the computer?

26th Jun 2017, 12:09 PM
Mkansi Eddie
Mkansi Eddie - avatar
2 Answers
+ 1
If you exceeds the limited size of the variable type you will just get a compiler error or else its better to use array of that type. To find out what will happen please use try..catch block. Because that would prevent any error that will crach your pc
26th Jun 2017, 12:39 PM
Nura Programmer
Nura Programmer - avatar
+ 5
it depends if the language has a longest number limit else of course memory but that may be rare
26th Jun 2017, 12:12 PM
Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer - avatar