term1 Definition1term2 Definition2term3 Definition3
Please sign in to your Google account to access your documents:
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?
*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?
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.
Need help typing ? See our FAQ (opens in new window)
Please sign in to create this set. We'll bring you back here when you are done.
Discard Changes Sign in
Please sign in to add to folders.
Sign in
Don't have an account? Sign Up »
You have created 2 folders. Please upgrade to Cram Premium to create hundreds of folders!