From 79fdd62c6bcb13c550050efe02d6753d198a5a83 Mon Sep 17 00:00:00 2001 From: Levi Bostian Date: Sat, 31 Aug 2013 16:51:35 -0500 Subject: Add function prototype to C. --- c.html.markdown | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'c.html.markdown') 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. -- cgit v1.2.3