...

/

Variables and Memory

Variables and Memory

Learn how variables are stored in memory.

Variables

To understand pointers, you must know how variables are stored in memory.

We have already seen that a variable is a named location in a computer’s memory where we can store our data.

See the program given below!

Press + to interact
C++
#include <iostream>
using namespace std;
int main() {
// Declares a variable John of type int
int John;
}

How are variables stored in memory?

Consider the analogy given in the previous lesson. The statement on Line No. 7 says reserve ...