summaryrefslogtreecommitdiffhomepage
path: root/c.html.markdown
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2013-09-20 22:13:10 -0500
committerLevi Bostian <levi.bostian@gmail.com>2013-09-20 22:13:10 -0500
commit35909645f2dbfedc38b566ec9838c2202cd51e3c (patch)
treec53066eb7caf2ee1bd4369e2495de8c0b9467761 /c.html.markdown
parent7c559d57a88143b0cbe7b16dbd071f0e07c83b32 (diff)
Edit note on function prototypes.
Diffstat (limited to 'c.html.markdown')
-rw-r--r--c.html.markdown13
1 files changed, 4 insertions, 9 deletions
diff --git a/c.html.markdown b/c.html.markdown
index 9745ed9a..df6cd036 100644
--- a/c.html.markdown
+++ b/c.html.markdown
@@ -41,6 +41,10 @@ enum days {SUN = 1, MON, TUE, WED, THU, FRI, SAT};
void function_1();
void function_2();
+// Must declare a 'function prototype' before main() when functions occur after
+// your main() function.
+int add_two_ints(int x1, int x2); // function prototype
+
// Your program's entry point is a function called
// main with an integer return type.
int main() {
@@ -410,15 +414,6 @@ int add_two_ints(int x1, int x2)
return x1 + x2; // Use return to return a value
}
-// Must declare a 'function prototype' before main() when creating functions
-void getInt(char c); // function prototype
-int main() { // main function
- return 0;
-}
-void getInt(char w) { //parameter name does not need to match function prototype
- ;
-}
-
//if function takes no parameters, do:
int getInt(void); for function prototype
// and for the function declaration: