From 672a0bc2400b51e57e6d73142cfa76010255a72c Mon Sep 17 00:00:00 2001 From: Connor McDowell Date: Thu, 8 Feb 2024 12:15:38 -0800 Subject: gone through some of the lecture, includes node and basic ref --- Inclass-9/Program.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'Inclass-9/Program.cpp') diff --git a/Inclass-9/Program.cpp b/Inclass-9/Program.cpp index 9942f85..b408bad 100644 --- a/Inclass-9/Program.cpp +++ b/Inclass-9/Program.cpp @@ -8,4 +8,49 @@ using std::cin; using std::cout; -using std::endl; \ No newline at end of file +using std::endl; + +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; +} + +int main() +{ + //basicreferences(); + node newNode = {}; + + newNode.data = 32; + + DoublesNodeDataRef(newNode); + + cout << newNode.data << endl; + + return 0; +} + -- cgit v1.2.3