Pointers in C Language with Examples: 20 flashcards
All 20 flashcards from this kit, free and with no sign-up.
1. What is a pointer in C?
Show the answer
A variable that stores a memory address rather than a data value.
2. What does the `&` operator do?
Show the answer
It returns the address of a variable (address-of operator).
3. What does the `*` operator do when applied to a pointer?
Show the answer
It dereferences the pointer, giving the value stored at that address.
4. If `p = &x`, what is `*p`?
Show the answer
It is exactly the same as `x` — the value stored at that address.
5. What does `int *p;` declare?
Show the answer
`p` is a pointer to an `int`.
6. In `int *a, b;`, what are `a` and `b`?
Show the answer
`a` is a pointer to int; `b` is a plain int.
7. What is `NULL` in C pointer context?
Show the answer
A special constant meaning the pointer points to nothing.
8. What happens if you dereference a `NULL` pointer?
Show the answer
Undefined behaviour — usually a program crash.
9. How does an array name behave in most expressions?
Show the answer
It decays to a pointer to its first element (`&arr[0]`).
10. What is the equivalence between `arr[i]` and pointer arithmetic?
Show the answer
`arr[i]` is exactly equivalent to `*(arr + i)`.
11. How far does `p + 1` advance if `p` points to an `int`?
Show the answer
By one `int` (typically 4 bytes), not by 1 byte.
12. Why pass a pointer to a function instead of the value?
Show the answer
So the function can modify the caller's original variable.
13. What is a pointer to pointer (`int **pp`)?
Show the answer
A pointer that stores the address of another pointer.
14. Which functions manage dynamic memory using pointers?
Show the answer
`malloc` and `free`.
15. What data structures are built from pointers linking nodes?
Show the answer
Linked lists, trees, and graphs.
16. What is a C string essentially?
Show the answer
A `char *` ending in the null character `'\0'`.
17. What do function pointers enable?
Show the answer
Callbacks and dispatch tables.
18. Which format specifier prints a pointer, and what cast is needed?
Show the answer
`%p`, with a cast to `void *` for portability.
19. What is dangerous about an uninitialised pointer?
Show the answer
It holds a garbage address and must never be dereferenced.
20. What does `*p = 100;` do if `p = &x`?
Show the answer
It writes 100 into `x` itself.
Your notes can be a kit like these
Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free, in 42 languages.
- Chapter notes
- Flashcards
- Practice MCQs
- Scored tests
- Exam prep
Get Veda free See what students get
Free to start · No ads · Works in 42 languages