Recall & Review
beginner
What does the address operator (&) do in C?
The address operator (&) gives the memory address of a variable. It tells where the variable is stored in memory.
Click to reveal answer
beginner
What is the purpose of the dereference operator (*) in C?
The dereference operator (*) accesses the value stored at a given memory address (pointer). It lets you read or change the value the pointer points to.
Click to reveal answer
beginner
Explain the difference between a pointer and a normal variable.
A normal variable stores a value directly. A pointer stores the address of another variable, not the value itself.
Click to reveal answer
beginner
Given
int x = 10; int *p = &x;, what does *p represent?*p represents the value stored at the address held by p. Here, it is the value of x, which is 10.Click to reveal answer
intermediate
Why is it important to use the dereference operator carefully?
Using the dereference operator on an invalid or uninitialized pointer can cause errors or crashes because it tries to access memory that may not belong to your program.
Click to reveal answer
What does the & operator do in C?
✗ Incorrect
The & operator returns the memory address of a variable.
If
int *p = &x;, what does *p mean?✗ Incorrect
*p accesses the value stored at the address pointed to by p, which is the value of x.Which operator is used to get the value stored at a pointer's address?
✗ Incorrect
The * operator dereferences a pointer to get the value at the address.
What happens if you dereference a pointer that is not initialized?
✗ Incorrect
Dereferencing an uninitialized pointer can cause crashes or undefined behavior.
Which of the following is a correct way to declare a pointer to an int?
✗ Incorrect
int *p; declares a pointer to an int.
Describe how the address (&) and dereference (*) operators work together with pointers in C.
Think about how you find where something is and then how you look inside it.
You got /3 concepts.
Explain why using the dereference operator on an invalid pointer is dangerous.
Consider what happens if you try to open a door that doesn't exist.
You got /3 concepts.