+ 1

i am not quite understanding variables please help

17th Nov 2016, 10:17 PM
Vance
4 Respuestas
+ 5
Variables are a way of holding data. For example: int x = 10 // Int means integer, or whole number. int y = 5 cout << x + y << endl; // It will print out 15, since x // is 10 and y is 5, so 10 + 5 = 15
17th Nov 2016, 10:25 PM
Keto Z
Keto Z - avatar
+ 1
Variables are used to hold information in memory. When you declare a variable, you assign that variable a spot in memory, which is also known as allocating memory, and is where your integers will be stored. Depending on the system being used, data types (int, long long, etc.) are able to store a particular amount of memory, so when you declare a type int variable , you actually allocate more than one spot in memory, because each spot can only hold 1 byte, having their unique address assigned to them in memory, where type int is 2 bytes (again depending on the system being used).
30th Nov 2016, 7:47 PM
Blood
Blood - avatar
0
thanks!!
17th Nov 2016, 10:27 PM
Vance
0
its just like variabel in algebra
2nd Dec 2016, 8:56 AM
Aakash Kumar Singh
Aakash Kumar Singh - avatar