summaryrefslogtreecommitdiffhomepage
path: root/c.html.markdown
diff options
context:
space:
mode:
Diffstat (limited to 'c.html.markdown')
-rw-r--r--c.html.markdown10
1 files changed, 10 insertions, 0 deletions
diff --git a/c.html.markdown b/c.html.markdown
index 96f253b7..75025b0c 100644
--- a/c.html.markdown
+++ b/c.html.markdown
@@ -422,6 +422,16 @@ int add_two_ints(int x1, int x2)
return x1 + x2; // Use return to return a value
}
+// Must declare a 'funtion prototype' before main() when creating functions
+// in file.
+int getInt(char c); // function prototype
+int main() {
+ return 0;
+}
+int getInt(char w) { //parameter name does not need to match function prototype
+ return 1;
+}
+
/*
Functions are pass-by-value, but you can make your own references
with pointers so functions can mutate their values.