#include
#include
int main (int argc, char** argv) {
int* p = malloc(sizeof(*p));
printf(“p = %p\n”, p);
//free(p); // the memory that p points to is released
printf(“p = %p (after free)\n”, p); // but the value of p has not changed
int* q = malloc(sizeof(*q)); // this malloc can reused the memory that p used
*q = 200;
*p = 100;
printf(“p = %p; q = %p\n”, p, q); // q might have the same value as p
printf(“*p = %d; *q = %d\n”, *p, *q); // if so, changing *p changes *q, which is BAD
}