From 35909645f2dbfedc38b566ec9838c2202cd51e3c Mon Sep 17 00:00:00 2001 From: Levi Bostian Date: Fri, 20 Sep 2013 22:13:10 -0500 Subject: Edit note on function prototypes. --- c.html.markdown | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'c.html.markdown') 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: -- cgit v1.2.3