aboutsummaryrefslogtreecommitdiff
path: root/Inclass-9/ReferenceExamples.cpp
blob: 30be6191894cee2eba19df6b0b2c34d17a46b4ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Program.cpp function code file.

#include <iostream>
#include "ReferenceExamples.h"

using std::cin;
using std::cout;
using std::endl;

void Swap(int& x, int& y)
{



}

void Standardize_101(int& n)
{
	

	// return n %= 101;
}

void Square(int& x)
{



}

void basicreferences()
{
	int variable = 15;

	int& ref = variable;

	int* address = &variable;

	ref++;

	cout << variable << endl;

	cout << address << endl;
}

struct node
{
	int data;

};

void DoublesNodeData(node node)
{
	node.data *= 2;
}

void DoublesNodeDataRef(node& node)
{
	node.data *= 2;
}

void DoublesNodeData(node* node)
{
	node->data *= 2;
}