W2: POINTERS Flashcards

_ Pointers, References, and Arrays

1
Q

W2-Q1: Definition of BUILT-IN TYPE? What are they?

A

_ 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

W2-Q2: What is a POINTER TYPE?

A

_ 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

W2-Q3: Describe some main points about NULL ADRESS

A

_ 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

W2-Q4: What is a WILD POINTER?

A

_ 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

W2-Q5: What is a GENERIC POINTER type?

A

_ 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

W2-Q6: What is a REFERENCE?

A

_ is an ALIAS for an EXISTING object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

W2-Q7: The standard library provides 2 functions for selecting the type of reference

A

std::ref() - returns an lvalue reference to its argument std::move() - returns an rvalue reference to its argument

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

W2-Q8: What is an ARRAY type?

A

_ 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

W2-Q9: What is a range-based FOR?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly