summaryrefslogtreecommitdiffhomepage
path: root/c.html.markdown
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2013-08-31 16:51:35 -0500
committerLevi Bostian <levi.bostian@gmail.com>2013-08-31 16:51:35 -0500
commit79fdd62c6bcb13c550050efe02d6753d198a5a83 (patch)
tree7feb860270565caffd6fa0ea78c67c3e0b356f42 /c.html.markdown
parentdfd8afb4969c76b71a852e7bc8378b7e7f8f4bb3 (diff)
Add function prototype to C.
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.