Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Introduction to Pointer | Pointers Fundamentals
C++ Pointers and References
course content

Зміст курсу

C++ Pointers and References

C++ Pointers and References

1. Pointers Fundamentals
2. Pointer Arithmetic
3. References Fundamentals
4. Dynamic Memory Allocation

Introduction to Pointer

A pointer is a variable that stores the memory address of another variable. It allows direct manipulation of memory, a powerful tool for dynamic memory allocation and efficient data manipulation.

Declaration and initialization of a pointer looks like this:

  • int: specifies the base type of the variable that the pointer will point to. In this case, it's an integer;
  • *: called dereference operator, returns the value stored at the address held by a pointer;
  • p_Name: the name of the pointer variable. You can choose any valid variable name;
  • nullptr: is a keyword that represents a null pointer, indicating that it is empty and doesn't point to anything.

Note

Commonly, pointers are named with a prefix p_ as a naming convention signifying that the variable is a pointer.

Завдання

  • Declare and initialize pointer with a nullptr.
  • Display a pointer for a chosen primitive data type.
  • Make sure its name has p_ prefix.

Once you've completed this task, click the button below the code to check your solution.

Завдання

  • Declare and initialize pointer with a nullptr.
  • Display a pointer for a chosen primitive data type.
  • Make sure its name has p_ prefix.

Once you've completed this task, click the button below the code to check your solution.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 1. Розділ 1
toggle bottom row

Introduction to Pointer

A pointer is a variable that stores the memory address of another variable. It allows direct manipulation of memory, a powerful tool for dynamic memory allocation and efficient data manipulation.

Declaration and initialization of a pointer looks like this:

  • int: specifies the base type of the variable that the pointer will point to. In this case, it's an integer;
  • *: called dereference operator, returns the value stored at the address held by a pointer;
  • p_Name: the name of the pointer variable. You can choose any valid variable name;
  • nullptr: is a keyword that represents a null pointer, indicating that it is empty and doesn't point to anything.

Note

Commonly, pointers are named with a prefix p_ as a naming convention signifying that the variable is a pointer.

Завдання

  • Declare and initialize pointer with a nullptr.
  • Display a pointer for a chosen primitive data type.
  • Make sure its name has p_ prefix.

Once you've completed this task, click the button below the code to check your solution.

Завдання

  • Declare and initialize pointer with a nullptr.
  • Display a pointer for a chosen primitive data type.
  • Make sure its name has p_ prefix.

Once you've completed this task, click the button below the code to check your solution.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 1. Розділ 1
toggle bottom row

Introduction to Pointer

A pointer is a variable that stores the memory address of another variable. It allows direct manipulation of memory, a powerful tool for dynamic memory allocation and efficient data manipulation.

Declaration and initialization of a pointer looks like this:

  • int: specifies the base type of the variable that the pointer will point to. In this case, it's an integer;
  • *: called dereference operator, returns the value stored at the address held by a pointer;
  • p_Name: the name of the pointer variable. You can choose any valid variable name;
  • nullptr: is a keyword that represents a null pointer, indicating that it is empty and doesn't point to anything.

Note

Commonly, pointers are named with a prefix p_ as a naming convention signifying that the variable is a pointer.

Завдання

  • Declare and initialize pointer with a nullptr.
  • Display a pointer for a chosen primitive data type.
  • Make sure its name has p_ prefix.

Once you've completed this task, click the button below the code to check your solution.

Завдання

  • Declare and initialize pointer with a nullptr.
  • Display a pointer for a chosen primitive data type.
  • Make sure its name has p_ prefix.

Once you've completed this task, click the button below the code to check your solution.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

A pointer is a variable that stores the memory address of another variable. It allows direct manipulation of memory, a powerful tool for dynamic memory allocation and efficient data manipulation.

Declaration and initialization of a pointer looks like this:

  • int: specifies the base type of the variable that the pointer will point to. In this case, it's an integer;
  • *: called dereference operator, returns the value stored at the address held by a pointer;
  • p_Name: the name of the pointer variable. You can choose any valid variable name;
  • nullptr: is a keyword that represents a null pointer, indicating that it is empty and doesn't point to anything.

Note

Commonly, pointers are named with a prefix p_ as a naming convention signifying that the variable is a pointer.

Завдання

  • Declare and initialize pointer with a nullptr.
  • Display a pointer for a chosen primitive data type.
  • Make sure its name has p_ prefix.

Once you've completed this task, click the button below the code to check your solution.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 1. Розділ 1
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt