#include <stdio.h>

int main() {
    int num = 10;
    int *ptr = NULL; // Remember to initialize pointers to NULL or a valid address

    ptr = &num; // Assign the address of num to ptr

    printf("The value of num is %d\n", num); // This is getting the value of num
    printf("The address of num is %p\n", &num); // This is getting the address of num
    printf("Value of ptr is %p\n", ptr); // This is getting the value of ptr, which is the address of num
    printf("Value pointed to by ptr %d\n", *ptr); // Dereferencing

    *ptr = 20; // Dereferencing ptr to change the value of num. Even though ptr is a pointer, it can be used to change the value of num directly because we go to the address of num and change the value there.

    printf("\nNew value of num %d\n", num);

    return 0;
}