Files
cpp-course/modules/05_pointers_and_references/src/pointer_basics.cpp
T

24 lines
362 B
C++
Raw Normal View History

2026-08-11 17:40:36 +03:00
#include "pointer_basics.hpp"
namespace pointers {
2026-08-15 17:20:47 +03:00
auto get_value(const int* ptr) -> int {
return *ptr;
}
void set_value(int* ptr, int value) {
*ptr = value;
}
auto is_null(const int* ptr) -> bool {
return ptr == nullptr;
}
void swap_via_pointers(int* a, int* b) {
const auto aux = *a;
*a = *b;
*b = aux;
}
2026-08-11 17:40:36 +03:00
} // namespace pointers