Recall & Review
beginner
What is a pointer in C?
A pointer is a variable that stores the memory address of another variable.
Click to reveal answer
beginner
How do you declare a pointer to an integer in C?
Use the syntax:
int *ptr; where ptr is a pointer to an integer.Click to reveal answer
beginner
What does the asterisk (*) mean in a pointer declaration?
The asterisk (*) indicates that the variable is a pointer to the type specified before it.
Click to reveal answer
intermediate
Explain the difference between
int *ptr; and int* ptr;.Both declare a pointer to an int. The placement of * does not change the meaning; it's a style choice.
Click to reveal answer
intermediate
What happens if you declare a pointer but do not initialize it?
The pointer contains a garbage address and using it without initialization can cause errors or crashes.
Click to reveal answer
Which of the following declares a pointer to a float?
✗ Incorrect
The correct syntax is
float *ptr; where the asterisk indicates a pointer.What does the pointer variable store?
✗ Incorrect
Pointers store the memory address where another variable is located.
How do you declare a pointer to a character?
✗ Incorrect
The correct declaration is
char* ptr;.What is wrong with this declaration?
int ptr;✗ Incorrect
Without the asterisk,
int ptr; declares a normal integer variable, not a pointer.Which symbol is used to declare a pointer variable?
✗ Incorrect
The asterisk (*) is used to declare a pointer variable.
Describe how to declare a pointer to an integer and explain what it stores.
Think about how you tell the computer to hold an address instead of a value.
You got /3 concepts.
Explain why it is important to initialize a pointer before using it.
Imagine using a map with a wrong address.
You got /3 concepts.