+ 10

Why do I need a variable in code?

7th Feb 2019, 7:59 PM
Игорь Игорь
Игорь Игорь - avatar
19 Réponses
+ 12
You need variable to hold or to store data. Try to make a program that asks for the users age and print the age of the user to screen. You need to store the value that the user gives and you need to retrieve this value when you want to print it to the screen. That is what variables are used for.
7th Feb 2019, 8:10 PM
sneeze
sneeze - avatar
+ 16
variable are container for storing info ...you need variable to store so e data
9th Feb 2019, 1:21 AM
👑Mahesh Khatri👑
👑Mahesh Khatri👑 - avatar
+ 10
To save memory used by your programs😉 To make works easier
9th Feb 2019, 4:19 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 8
You need it whenever you want to store any value for later use. For example you want to write a program where the user enters his name and you tell him how many letters it has. First the user input has to go somewhere so that later you can count the letters. And the 'pot' where you put the name is a variable.
7th Feb 2019, 8:08 PM
HonFu
HonFu - avatar
+ 7
Variables are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves. It is helpful to think of variables as containers that hold information. Their sole purpose is to label and store data in memory. This data can then be used throughout your program.
8th Feb 2019, 3:12 PM
🆂🅷🅾🆅🅰🅽
🆂🅷🅾🆅🅰🅽 - avatar
+ 6
Variables hold the data your code works with.
8th Feb 2019, 2:05 AM
Ken Long
Ken Long - avatar
+ 5
Without variables you may need a new program for every new situation and set of data and you might as well not use a program.
9th Feb 2019, 4:14 AM
Sonic
Sonic - avatar
+ 4
if you want to gate input from user, you need to create new variable. Apart from that, you need some storage to keep your input, so that variable is needed. if you don't have any variable, you will have to write every time when you need some data to be entered in your program. In short, you can do nothing without variable:))
8th Feb 2019, 9:54 AM
Khurshidbek Kobilov
Khurshidbek Kobilov - avatar
+ 3
Variables are used to store values or data...for e.g....x is my var and I want to store 10 in x..then int x=10;
8th Feb 2019, 5:52 PM
mangai selvam
mangai selvam - avatar
+ 3
So as to represent a number with an alphabet and it will be easier to use. E.g: let a=2 A+2 Result: 4 U see here i am representing it with an alphabet 2. It can be used to store values i.e example 1 above 3. To hold or store data
8th Feb 2019, 7:03 PM
Adetunji Dorcas
Adetunji Dorcas - avatar
+ 2
Variable is a named location in a memory where a program can manipulate a data. This location is used to hold the variable.
8th Feb 2019, 3:19 PM
Oviya arumugam
Oviya arumugam - avatar
+ 2
You need variables in C++ to store values. If you make something like a video game with a level system, how will you store the values? Without variables, it's a 1-time thing. If you have a number you have to find out its value later, you use a variable. Without variables, most programs wouldn't be possible.
8th Feb 2019, 7:40 PM
Evan Skyberg
Evan Skyberg - avatar
+ 2
Variable is needed to store values in order to do various operations
9th Feb 2019, 9:51 AM
Satyam Rai
Satyam Rai - avatar
+ 1
Variable is very necessary to a program because it is used to store a value for the integers characters et cetera
8th Feb 2019, 11:53 AM
Oviya arumugam
Oviya arumugam - avatar
+ 1
Variable should not be a keyword
8th Feb 2019, 11:54 AM
Oviya arumugam
Oviya arumugam - avatar
+ 1
To make a programs , web pages , design of something or video game.
13th Feb 2019, 3:59 AM
Amazing Musics
0
Variables are used to store data and access data from memory You can easily access data from memory by variable name
9th Feb 2019, 7:30 PM
Akash
Akash - avatar
0
Imagine you didnt have variables, it would make life very difficult; take these simple exaples: imagine you wanted to write a clock app that told the user the time. you would have to release one app for every time zone in the world; the user wouldn’t be able to use the app if they went on holiday to a different time zone. imagine you wanted to add an alarm clock, you would need a variable to allow the user to store the time at which they wanted the alarm to go off think of all the apps for your device - you couldn’t add new ones without variables to remember whcih apps you’ve added or bought the list is endless...
9th Feb 2019, 8:07 PM
Mark