// 24T2 COMP1511 Week 5 Lecture 2 // Tammy Zhong #include int main(void) { // Delcare and initialise a normal int variable `num` // TODO int num = 8; // Declare a pointer variable `num_ptr` and assign the address of `num` to it // TODO int *num_ptr = # // address of `num` // Print them out // TODO printf("The address that num_ptr is storing: %p (num_ptr) %p (&num), with the value of %d\n", num_ptr, &num, *num_ptr); // Dereference the pointer `num_ptr` and print it out printf("The address of where the num_ptr variable is: %p\n", &num_ptr); // Print the pointer variable's address // TODO // Modifying pointer values // TODO printf("num: %d\n", num);// 8 *num_ptr = 24; printf("num: %d\n", num); int *num_ptr2 = num_ptr; // make num_ptr2 point to where num_ptr is pointing at *num_ptr2 = 10; printf("num: %d\n", num); int num2 = 4; num_ptr = &num2; printf("*num_ptr %d\n", *num_ptr); return 0; }