pointer

#include <iostream>
using namespace std;

int main() {
    int num = 10;
    int *ptr = &num;

    cout << "Value of num: " << num << endl; // Step 1
    cout << "Address of num: " << &num << endl; // Step 2

    cout << "Value of ptr: " << ptr << endl; // Step 3
    cout << "Address of ptr: " << &ptr << endl; // Step 4
    cout << "Value pointed by ptr: " << *ptr << endl; // Step 5

    return 0;
}

Step 1: Declare and initialize an integer variable num with a value of 10. Step 2: Output the value of num. Step 3: Declare an integer pointer ptr and assign the address of num to it using the address-of operator &. Step 4: Output the address stored in the pointer variable ptr. Step 5: Output the value pointed to by the pointer variable ptr using the dereference operator *.