repl.it
@molinitomario/

Introduction to variables

C++

No description

fork
loading
Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>

int main() {
  int variable;
  // above we are defining variable as a int

  variable = 10;
  // above we are declaring that variable is eqal to 10

  // value - is a single piece of data stored in memory somewhere
  
  // variable is a value

  // Object - a region of storage tha thas a value

  // "variable" is a variable because it is a named object

  // identifier name of the object
  // "int" is an idintifier it tells the program that the value being stored is going to be of the type int, same applies for everything else

  // Instantiation - objec will be created and assigned a memory address

  int z{5};
  std::cout << z;

  int u(5);
  std::cout << u;

  // the above lines are examples of direction and uniform init. these are giving z and u their values at the point of which they are created. unlike copy init.

  int p = 10;

  // which just creates the variable and then later down the line assigns the value to it

  


}
Fetching token
?