Зміст курсу
C Basics
C Basics
Pointers
Using the reference operator &
and the dereference operator *
, we can create and work with pointers.
A pointer is a data type, just like int
, char
, or double
.
The pointer is designed to store an address, which you can obtain using the &
operator.
To declare a pointer, prepend it with the *
character.
In essence, a pointer is a variable that holds the address of another object.
Note
Typically, pointers are named by prefixing the letter
p
to the name of the object they're pointing to.
When you dereference a pointer, you access the value of the variable it points to.
Main
Note
*(&variable) == *pVariable
If you attempt to dereference a null pointer, the compiler will raise an error:
Example provided to showcase the mistake
Main
Завдання
Determine the size of int
and double
pointers.
Завдання
Determine the size of int
and double
pointers.
Все було зрозуміло?
Pointers
Using the reference operator &
and the dereference operator *
, we can create and work with pointers.
A pointer is a data type, just like int
, char
, or double
.
The pointer is designed to store an address, which you can obtain using the &
operator.
To declare a pointer, prepend it with the *
character.
In essence, a pointer is a variable that holds the address of another object.
Note
Typically, pointers are named by prefixing the letter
p
to the name of the object they're pointing to.
When you dereference a pointer, you access the value of the variable it points to.
Main
Note
*(&variable) == *pVariable
If you attempt to dereference a null pointer, the compiler will raise an error:
Example provided to showcase the mistake
Main
Завдання
Determine the size of int
and double
pointers.
Завдання
Determine the size of int
and double
pointers.
Все було зрозуміло?
Pointers
Using the reference operator &
and the dereference operator *
, we can create and work with pointers.
A pointer is a data type, just like int
, char
, or double
.
The pointer is designed to store an address, which you can obtain using the &
operator.
To declare a pointer, prepend it with the *
character.
In essence, a pointer is a variable that holds the address of another object.
Note
Typically, pointers are named by prefixing the letter
p
to the name of the object they're pointing to.
When you dereference a pointer, you access the value of the variable it points to.
Main
Note
*(&variable) == *pVariable
If you attempt to dereference a null pointer, the compiler will raise an error:
Example provided to showcase the mistake
Main
Завдання
Determine the size of int
and double
pointers.
Завдання
Determine the size of int
and double
pointers.
Все було зрозуміло?
Using the reference operator &
and the dereference operator *
, we can create and work with pointers.
A pointer is a data type, just like int
, char
, or double
.
The pointer is designed to store an address, which you can obtain using the &
operator.
To declare a pointer, prepend it with the *
character.
In essence, a pointer is a variable that holds the address of another object.
Note
Typically, pointers are named by prefixing the letter
p
to the name of the object they're pointing to.
When you dereference a pointer, you access the value of the variable it points to.
Main
Note
*(&variable) == *pVariable
If you attempt to dereference a null pointer, the compiler will raise an error:
Example provided to showcase the mistake
Main
Завдання
Determine the size of int
and double
pointers.