From e40090ed64d4bc44f0828eea56c3c155a5fe4594 Mon Sep 17 00:00:00 2001 From: Jet Hughes Date: Mon, 8 Aug 2022 11:21:12 +1200 Subject: [PATCH] vault backup: 2022-08-08 11:21:12 --- content/notes/09-intro-to-c-2.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/content/notes/09-intro-to-c-2.md b/content/notes/09-intro-to-c-2.md index d5a7f429e..04e9d847f 100644 --- a/content/notes/09-intro-to-c-2.md +++ b/content/notes/09-intro-to-c-2.md @@ -5,7 +5,7 @@ tags: - cosc204 --- -# Variables +# Variables and Pointers ``` va memory[3] @@ -16,5 +16,22 @@ va memory[3] `*` is known as **dereferncing** `**` is known as **double-dereferncing** +## Names and places +names are allocated to emmory locations of declaration +`&b;` wherever in memory b is stored +## Why Pointers +- abstractions + - dont need to know which "object" to manipulate +- ability to change a parameter +- multiple return values from a routine +- efficiency + - dont need to copy anything to pass a pointer + +## Call by value +- The value of the variable is passed to the called routine. +- changes to the parameter do not propogate to the caller + +## Call by address +- address of parameter is passed to the rountine \ No newline at end of file