About variables | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

About variables

I'm new to coding So I don't really understand the use of variables in coding

13th Dec 2018, 6:47 AM
Jack Marley
Jack Marley - avatar
3 Answers
+ 5
This question appears to be frequently asked. You can make use of the search bar to get answers to your queries. In short, variables are simply containers used to store data. If you are writing a program to add two numbers, you can't just do: std::cout << 1+1; This program would print two every time you run it. You may want variables which can be used to store user input, and then compute the result of said user input. int a, b; std::cin >> a >> b; std::cout << a+b; https://www.sololearn.com/Discuss/11892/?ref=app https://www.sololearn.com/Discuss/1351993/?ref=app https://www.sololearn.com/Discuss/125006/?ref=app
13th Dec 2018, 7:13 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
Why do people who have barely touched the courses (looking at you, OP) ask questions? There should be an SL rule for Q&A: at least 50%-75% of a course done to post.
13th Dec 2018, 8:25 AM
non
+ 2
They are containers that hold some data value. Basically their sole purpose is to label and store data in memory. This data can then be used throughout your program. https://www.sololearn.com/learn/CPlusPlus/1606/ http://www.cplusplus.com/doc/tutorial/variables/
13th Dec 2018, 7:19 AM
dρlυѕρlυѕ
dρlυѕρlυѕ - avatar