summaryrefslogtreecommitdiffhomepage
path: root/c.html.markdown
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2013-08-31 18:54:07 -0500
committerLevi Bostian <levi.bostian@gmail.com>2013-08-31 18:54:07 -0500
commitd632203255085171ce79a106a40797d1d5fa54a3 (patch)
treef752b03089932e475deb8fee23fe35fe10721e29 /c.html.markdown
parent394ca958b3b61853b1fe8ec1063b3adb03239178 (diff)
Add more notes to function prototype in C.
Diffstat (limited to 'c.html.markdown')
-rw-r--r--c.html.markdown9
1 files changed, 6 insertions, 3 deletions
diff --git a/c.html.markdown b/c.html.markdown
index 90d0d358..ee60d168 100644
--- a/c.html.markdown
+++ b/c.html.markdown
@@ -425,13 +425,16 @@ int add_two_ints(int x1, int x2)
// Must declare a 'funtion prototype' before main() when creating functions
// in file.
-int getInt(char c); // function prototype
+void getInt(char c); // function prototype
int main() {
return 0;
}
-int getInt(char w) { //parameter name does not need to match function prototype
- return 1;
+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: int getInt(void) {}
+// this is to keep compatibility with older versions of C.
/*
Functions are call by value. So when a function is called, the arguments passed