Variables | Sololearn: Learn to code for FREE!



So I don’t get variables that well how can I use them?


11/17/2018 2:52:01 PM


5 Answers

New Answer


Variable is a data container for any program you have created Example int container=25; (int) is data container type (container) is data container have a value is 25 // Happy coding ;)


variables are called variables because their value can vary . 1,2,3,e,pi etc have some fixed values so are called constants variables can take value of multiple constants , example : int x = 1; //x is 1 x=2; //x is 2 now //U see how variable x changed from 1 to 2 , well that is the use of variable , we can change its value //we also have final variables which behave like a constant whose value can't be changed


variables are used to store information in a specific place... so when you use them, the computer knows where to retrieve that information. They can be used in various ways. think of a calculator... when you enter a number it is placed in a variable. then when you do a calculation. it will retrieve those numbers and calculate a result which is also stored in a variable :)


Variable is nothing but the symbolic name given to a memory location. The property of the variable is that it changes during the execution of program e.g)int abc=10; In this example a memory location named abc holds the value 10 The value at any memory location is accessed using the variable

0 There are already similar (if not identical) questions posted, such as the one(s) above. You can find the answers using the search bar. Please help keep the quality of posts high in this section of the forum, SoloLearn servers uncluttered, and app latency low by reviewing the following: Be sure not to miss the link to the Community Guidelines toward the bottom of the article. Happy coding! P.S. Please see the following post for a humorous interpretation (but still an earnest plea).