Files
gpd-924/CPlusPlus/Pointer/functions.cpp
T
david 89459f9cfc add pointer
add smart pointer
2025-09-22 12:47:22 +02:00

18 lines
246 B
C++

#include "functions.h"
void changeInteger(int n)
{
n *= 2;
}
void changeIntegerPerPointer(int* pN)
{
if (pN == nullptr) return; // BE CAREFUL - a pointer can always be nullptr
*pN *= 2;
}
void changeIntegerPerReference(int& n)
{
n *= 2;
}