Why are variables needed in software?

anushka jain October 14, 2012

What does a variable really mean, and are they present in every program?

  1. Nikhil Chandak
    October 25, 2012 at 10:54 am

    wat are variables u can find out here

  2. Kendra Garwin
    October 17, 2012 at 4:31 am

    Similar to what Bruce said, think of a variable as a place holder. Take, for example, the sentence:

    "Color the wall _____."

    You don't know what color to paint the wall until a person comes along and fills in that blank. Until then, the instructions can't and won't be carried out. That's what a variable does: it's a way to outline some basic instructions without getting into what can only be addressed later by (usually) the end user.

  3. Kim Diaz
    October 14, 2012 at 4:50 pm

    It is needed for the software to be able to intiate movement along the whole process

  4. Timothy Clark
    October 14, 2012 at 4:33 pm

    Simply put... a variable for a program is no different than the variables in algebra, for the most part. Though the use of variables in programming is more broad, in certain ways. A variable is simply a character that stands for something else. X could be an amount, a function, or any number of programmable items in a program. The variable is just a marker for where something needs to be plugged in in a equation, or field. Example:
    When programming a simple calculator application you would use variables to denote what would be left open to plug in your numbers on the equation side of the problem.

    Answer your question? Hope so.

  5. Adrian Rea
    October 14, 2012 at 3:53 pm
  6. Rob Hindle
    October 14, 2012 at 3:07 pm

    I guess from the question you're not a programmer! So I'm trying to guess why you ask the question as variables crop up almost as soon as you start to learn any programming language.

    For example you might write something like:

    for x = 1 to 10 print "hello".

    That would print "hello" ten times
    x is a variable and it's being used to count how many times "hello" is printed.

    Sometimes when you are installing a program as a user rather than a programmer you may be asked to "set some variables". What they mean there is give a value to a variable that the program will then use. For example when you set up a desktop email program like MS Outlook the variables you need to set will include your email address and password.

  7. Dimal Chandrasiri
    October 14, 2012 at 7:47 am

    variables are basically sort of baskets that are inside the memory. say there are different baskets for different types. and this describes different variable types. if you want to hold a certain type of data, you need that same type of variable in the memory. and you should give a name for each an every basket ( variable ) you create so you can understand it in the future. and programs use variables to store values so that they can manipulate them to get the expected result.

  8. Bruce Epper
    October 14, 2012 at 6:13 am

    A variable is used to store a value that changes with every run of a program. Without them, a program would be pretty useless since it would only be able to work with the data it already knows about and nothing else. For example, a variable can be used to store the name of the current user. If a different user uses the program, the variable can be changed to reflect the name of the new user instead of calling everybody 'Bob'.

    • anushka jain
      October 17, 2012 at 12:50 pm

      thanks !!! it really helped.....

Ads by Google