+ 1
i am not quite understanding variables please help
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
+ 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).
0
thanks!!
0
its just like variabel in algebra