What does the address-of operator `&` produce?
The address-of operator `&` produces a pointer to an object or function, such as `int* p = &score;`.
Study 07 Pointers and Memory Basics with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What does the address-of operator `&` produce?
The address-of operator `&` produces a pointer to an object or function, such as `int* p = &score;`.
What does dereferencing a valid object pointer do?
The dereference operator `*` designates the object pointed to. Reading `*p` accesses it, while assigning to `*p` changes it.
What happens when an invalid pointer is dereferenced?
Dereferencing a null, dangling, uninitialized, or out-of-range pointer is undefined behavior; C++ places no requirements on the result.
How do `const int*` and `int* const` differ?
`const int* p` allows the pointer to change but not the pointed-to `int`; `int* const p` allows the `int` to change but not the pointer.
What value does an uninitialized pointer contain?
An uninitialized pointer contains an indeterminate value. It should be initialized before use, commonly to `nullptr` when it has no target.
Why is `nullptr` preferred for null pointers?
`nullptr` represents a null pointer value and has type `std::nullptr_t`. It is preferred to `0` and `NULL` for expressing pointer intent.
What does adding `1` to a pointer advance?
For an array pointer, adding `1` advances by one element of the pointed-to type, not by one byte.
May a one-past-the-end pointer be dereferenced?
A one-past-the-end pointer may be formed and used as a boundary marker, but it must not be dereferenced.
What conversion usually occurs when an array is used in an expression?
In most expressions, an array converts to a pointer to its first element. The array and pointer remain different types.
How is the array subscript `a[b]` defined?
`a[b]` means, in effect, `*(a + b)`. Therefore `values[2]` and `*(values + 2)` access the same element.
Does an array parameter preserve the array's length?
In a function parameter list, `int values[]` is adjusted to mean `int* values`; it does not convey the array length.
How can a pointer parameter modify the caller's object?
A function receives a copy of the pointer, but modifying `*value` changes the caller's object because both pointers designate that object.
A 14-question medium-difficulty quiz on Boolean algebra, logic gates, truth tables, and combinational circuits.
A focused set of flashcards covering Python variables, data types, expressions, control flow, functions, input, output, and common programming practices.
Learn how Boolean expressions, logical operators, and conditional structures let programs make reliable decisions, including how to handle boundaries, branch order, and testing.
Learn how computer memory stores and addresses information, how RAM and ROM differ, and how caches and the memory hierarchy balance speed, capacity, and cost.
A progressive guide to tree structure, binary-tree traversals, binary search tree operations, deletion, balancing, and the way tree height determines time and space costs.
A practical guide to integrating problem definition, data representation, modular programming, algorithms, complexity analysis, testing, correctness, and ethical evaluation into a responsible computer science capstone.
Reviews how interrupts support event handling and multitasking, and how Linux system calls use the RISC-V `ecall` instruction and register conventions.
This quiz covers process management, context switching and scheduling, multitasking, traps and interrupts, and RISC-V privilege transitions.
A quiz on operating-system system calls, including privileged-operation requests, process creation and execution with fork, exec, and waitpid, and signal handling.