#include <iostream>


int main() {

  int num = 5;

  int *ptr;


  // Assign the address of num to ptr

  ptr = &num;


  // Access the value of num through the pointer

  std::cout << "The value of num is " << *ptr << std::endl;


  // Modify the value of num through the pointer

  *ptr = 6;

  std::cout << "The modified value of num is " << num << std::endl;


  return 0;

}

output :

The value of num is 5
The modified value of num is 6