add pointer
add smart pointer
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user