721
edits
Line 26: | Line 26: | ||
It's called "stack" because the variables really stack up there, on after the other, depending of the order you instantiate them. The syntax for creating a Point2D as a stack variable is as follows: | It's called "stack" because the variables really stack up there, on after the other, depending of the order you instantiate them. The syntax for creating a Point2D as a stack variable is as follows: | ||
<source lang="c++" | <source lang="c++" highlight="4">Point2D p1 = Point2D(1,2);</source> | ||
If we use pointers however we can use memory space everywhere in the main memory. This space is used by other programs as well and rather loosely organized. This is why it is called "heap". | If we use pointers however we can use memory space everywhere in the main memory. This space is used by other programs as well and rather loosely organized. This is why it is called "heap". |