C++ Ch.9 Pointers Flashcards
Each byte in memory is assigned a unique _________.
Address
The ________ operator can be used to determine a variables address.
& (Address Operator)
_________ variables are designed to hold addresses.
Pointer
The ________ operator can be used to work the variable a pointer points to.
Indirection
Array names can be used as ________, and vice versa.
Pointers
Creating variables while a program is running is called _________.
Dynamic memory allocation
The _______ operator is used to dynamically allocate memory.
new
Under old compilers, if the new operator cannot allocate the amount of memory requested it returns ______.
null
A pointer that contains the address 0 is called a(n) ________.
null pointer
When a program is finished with a chunk of dynamically allocated memory, it should free it with the _______ operator.
delete
You should only use pointers with delete that were previously used with ________.
new
Each byte of memory is assigned a unique address. (T/F)
True
The * operator is used to get the address of a variable. (T/F)
False
Pointer variables are designed to hold addresses. (T/F)
True
The & symbol is called the indirection operator. (T/F)
False
The & operator dereferences a pointer. (T/F)
False
When the indirection operator is used with a pointer variable, you are actually working with the value the pointer is pointing to. (T/F)
True
Array names cannot be dereferenced with the indirection operator. (T/F)
False
When you add a value to a pointer, you are actually adding that number times the size of the data type referenced by the pointer.
(T/F)
True
The address operator is not needed to assign an array’s address to pointer. (T/F)
True
You can change the address that an array name points to. (T/F)
False
Any mathematical operation, including multiplication and division, may be performed on a pointer. (T/F)
False
Pointers may be compared using the relational operators. (T/F)
True
When used as function parameters, reference variables are much easier to work with than pointers. (T/F)
True
The “new” operator dynamically allocates memory. (T/F)
True
A pointer variable that has not been initialized is called a null pointer. (T/F)
False
The address 0 is generally considered unusable. (T/F)
True
In using a pointer with the “delete” operator, it is not necessary for the pointer to have been previously used with the “new” operator.
(T/F)
False