Pointers Flashcards

1
Q

What is a pointer

A

A variable;e that hold a memory address and not data like most variables

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

How to declare pointer

A

Using * before the pointers name

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

What is the revenue operation

A

& obtains a variables address. Returns the memory address

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

What is the derefrance operator

A

Retrieve the data to which the pointer points to

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

What is the new operator

A

Allocates memory for the given type and returns a pointer to the allocated memorY

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

Allocating for a type that is a class

A

The new operator calls the class’s constructor after allocating memory for the classes member variables

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

What is the member access operator

A

Allows access y]to the objects same as *

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

What is the delete operator

A

Dell Oates a block or memory, if pointer is null delete has no effect

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

What is a dangling pointer?

A

When the object that a pointer is pointing to gets deleted. That ends up with that -linter pointing to a deleted object

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

What’s a memory leak

A

When memory is in the head can’t be accessed. A pointer is moved but the addresses in memory was not correctly stored

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

What is static memory

A

Region where global variables and static local variables are allocated. Spastic variables are allocated once and stay in the same memory location

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

What is the stack

A

Region where functions local variables are allocated. Function call adds local va7]risk led to the stack and return removes them. Also called automatic memory

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

What is the heap

A

Region where the new operator allocated memory and where the delete operator deslocaresmemory. The region is also called free store

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