W2: POINTERS Flashcards
_ Pointers, References, and Arrays
W2-Q1: Definition of BUILT-IN TYPE? What are they?
_ A built-in type is a type that can be built from a FUNDAMENTAL type, using the const qualifier and the DECLARATOR operators ([], * and &)
_ Pointers, references and arrays are BUILT-IN types.
_ Built-in types access their underlying types through their addresses
W2-Q2: What is a POINTER TYPE?
_ A pointer type is a type that HOLDS an ADDRESS
_ Each type (fundamental, built-in or user-defined) has a pointer type associated with it.
W2-Q3: Describe some main points about NULL ADRESS
_ the null address CANNOT be DEFERENCED.
_ keyword nullptr refers to the constant that stores this address.
_ Any attempt to DEREFERENCE a pointer that holds the value nullptr causes a run- time ERROR
W2-Q4: What is a WILD POINTER?
_ is a pointer that has NOT been initialized to any address
_ It is good style to initialize every wild pointer to nullptr.
_ Any run-time attempt to dereference the address will TERMINATE execution rather than generate erroneous results.
W2-Q5: What is a GENERIC POINTER type?
_ is a pointer type that is not associated with any particular type
_ a pointer of generic type can hold the ADDRESS of a variable or object WITHOUT holding its type INFO
W2-Q6: What is a REFERENCE?
_ is an ALIAS for an EXISTING object
W2-Q7: The standard library provides 2 functions for selecting the type of reference
std::ref() - returns an lvalue reference to its argument std::move() - returns an rvalue reference to its argument
W2-Q8: What is an ARRAY type?
_ is a type that consists of elements of identical type arranged contiguously in memory.
_ Each element is a subobject of the array type.
_ An array type is declared using the [] declarator operator.
W2-Q9: What is a range-based FOR?
is an ITERATION construct specifically designed for use with collections of any form.
_ can infer the type of each element in the array from the array declaration itself