Pointers Flashcards

1
Q

What happens when we declare a variable in C?

A

Variable will be assigned to a certain memory address

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

An addressable memory cell can store up to _ byte/s

A

one

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

A variable will be assigned only to a _____________

A

free memory cell

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

A value that we get when we access a variable that is not initialized

A

garbage value

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

Contains the address of another variable

A

Pointers

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

Pointer Syntax

A

<dataType> *<ptrName>
</ptrName></dataType>

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

Returns the address of the variable

A

Address Operator (&)

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

AKA dereferencing
Refers to the memory cell whose address is specified by the pointer variable

A

Indirection Operator (*)

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

Pointer variable that points to another pointer

A

Pointer to a pointer

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

Pointer to a pointer syntax

A

<dataType> **<ptrName>
</ptrName></dataType>

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

____________ define what value a pointer to a pointer can hold

A

num of asterisks

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

Usually, the most number of asterisks used is only ___

A

two

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

A pointer P, can hold the address of a variable Q if:

A
  1. P and Q have the same data type
  2. Q has one less asterisk than P
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Maximum number of indirection operators (*) that can be used in the pointer is ________

A

same # as its declared #

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

Referencing an uninitialized pointer may result to a __________

A

segmentation fault error

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

A pointer that points to “nothing” can be initialized the _____ value

A

NULL

17
Q

Advantages of using pointers (4)

A
  1. Allows you to modify other variables
  2. Referencing array elements
  3. Support of dynamic allocation
  4. Support of dynamic structures