// Step 1: Include necessary header file
#include <iostream>
// Step 2: Define main function
int main() {
// Step 3: Declare variables
int var = 5;
int *ptr;
// Step 4: Assign address of 'var' to pointer 'ptr'
ptr = &var;
// Step 5: Display the value of 'var'
std::cout << "Value of var: " << var << std::endl;
// Step 6: Display the address of 'var' using the pointer 'ptr'
std::cout << "Address of var: " << ptr << std::endl;
// Step 7: Display the value at the address stored in 'ptr'
std::cout << "Value at the address pointed by ptr: " << *ptr << std::endl;
// Step 8: Modify the value of 'var' through the pointer 'ptr'
*ptr = 10;
// Step 9: Display the updated value of 'var'
std::cout << "Updated value of var: " << var << std::endl;
// Step 10: Create a pointer with the 'new' keyword
int *dynPtr = new int;
// Step 11: Allocate memory for the dynamic pointer
*dynPtr = 20;
// Step 12: Display the value stored in the dynamic pointer
std::cout << "Value of dynPtr: " << *dynPtr << std::endl;
// Step 13: Deallocate memory for the dynamic pointer
delete dynPtr;
// Step 14: Set pointer to nullptr after deletion
dynPtr = nullptr;
// Step 15: Return 0 to indicate successful execution
return 0;
}