add pointer

add smart pointer
This commit is contained in:
2025-09-22 12:47:22 +02:00
parent 2dc23a4efc
commit 89459f9cfc
6 changed files with 324 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
#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;
}