Pointers: Part 1 Flashcards

1
Q

pointer

A

a variable whose value is a memory address

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

Assign the address of var to a pointer ptr

A

ptr = &var;

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

What does ptr = &val mean

A

ptr is a pointer variable of the same data type as val that stores the memory address of val

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

What operator must be used to create a pointer variable?

A

The indirection/dereferencing (*) operator - it declares the datatype of the pointer variable

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

What is the purpose of the indirection/dereferencing operator?

A

The * operator is used:
- to assign the value stored at the memory address pointed to by a pointer variable. E.g. - val = *ptr // finding the value ptr points to
- to declare a pointer variable. E.gs - int * pi, char * pc

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