Pointers
Gapfill exercise
Enter your answers in the gaps. When you have entered all the answers, click on the "Check" button.
What is a pointer?
The pointer in C language is a variable which
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
the address of another
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
. This
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
can be of type int, char, array,
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
, or any other pointer. The size of the
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
depends on the
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
. However, in 32-bit architecture the size of a pointer is
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
byte.
How to declare a pointer?
The pointer in c language can be
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
using * (asterisk symbol). It is also known as
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
pointer used to
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
a pointer.
int *a;//pointer to int
char *c;//
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
to char
What are the Advantages of pointer?
1) Pointer
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
the code and improves the performance, it is used to
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
strings, trees, etc. and used with arrays, structures, and
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
.
2) We can return multiple
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
from a function using the pointer.
3) It makes you able to access any memory
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
in the computer's
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
.
What is Address of (&) operator?
The
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
of operator '&'
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
the address of a
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
. But, we need to use %u to
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
the address of a
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
.
What is NULL pointer?
A
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
that is not assigned any
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
but
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
is known as the NULL pointer. If you don't have any
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
to be
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
in the pointer at the time of
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
, you can
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
NULL
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
. It will provide a better approach.
How to read the pointer: int (*p)[10].
To read the
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
, we must see that () and [] have the equal
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
. Therefore, their
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
must be considered here. The
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
is left to right, so the priority goes to ().
Inside the
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
(),
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
operator * and pointer name (identifier) p have the
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
precedence. Therefore, their associativity must be considered here which is right to left, so the
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
goes to p, and the second
2
address
architecture
assign
associativity
bracket
declaration
declared
dereference
display
function
functions
indirection
location
memory
NULL
pointer
precedence
priority
reduces
retrieving
returns
same
specified
stores
value
values
variable
goes to *.
Check
OK