Files
cpp-course/modules/05_pointers_and_references/src/pointer_basics.cpp
T
2026-08-15 17:20:47 +03:00

24 lines
362 B
C++

#include "pointer_basics.hpp"
namespace pointers {
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;
}
} // namespace pointers