• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/8

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

8 Cards in this Set

  • Front
  • Back
  • 3rd side (hint)

What is a pointer?

A pointer is a programming language object, whose value refers to (or "points to") another value stored elsewhere in the computer memory using its address.

"Points to"

What is dereferencing?

A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer.

To obtain a ... ?

What character is used to declare a pointer?

Asterisk *



int* piNumber;

"int piNumber;" is missing a?

What character is used to dereference a pointer?

Asterisk *



int* piNumber;


*piNumber = 42;

Same as declaring a pointer, only in a different context.

What character is used to obtain the pointer (address) of a variable?

Ampersand &



int iNumber = 42;


int* piNumber = &iNumber;

It's not asterisk.

Are the lines below equal?



int* piNumb1, piNumb2;



int* piNumb1, * piNumb2;

No.



The first line is equal to:


int* ipNumb1;


int ipNumb2;



But the second one creates two pointers to int like expected.

Caveat.

Is a declared array variable a pointer?



int aiNumbers[4];

Yeahish, it can be implicitly converted and treated as a pointer of its type to the first element.



int iaNumbers[4];


int* piNumber = iaNumbers;


*piNumbers = 42;



iaNumbers[0] is now 42.



However accessing an element directly gets the value, so the line below is a no no.



int* ipCompilerError = iaNumbers[0];

Explicitly or implicitly?

What character is used to create a reference variable to a value?

Ampersand &


int iNumb = 0;


int& iNumbRef = iNumb;


iNumbRef = 42;


// iNumb is now 42

Same as the one used to get the pointer (address) to a variable.