summaryrefslogtreecommitdiff
path: root/cbook/one_one.c
diff options
context:
space:
mode:
authorCody Hiar <cody@hiar.ca>2020-03-10 13:38:39 -0600
committerCody Hiar <cody@hiar.ca>2020-03-10 13:38:39 -0600
commit2cd866e3fa0cbec2b53a3b5851792da320fc1c71 (patch)
treea446b7fdaa648aea51dc6569caf77a8b4a599eed /cbook/one_one.c
parent0bcd56cb0e42761903431081ddcf00790627b505 (diff)
Running two examples from cbook
Diffstat (limited to 'cbook/one_one.c')
-rw-r--r--cbook/one_one.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/cbook/one_one.c b/cbook/one_one.c
new file mode 100644
index 0000000..9896026
--- /dev/null
+++ b/cbook/one_one.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+
+/*
+* Tell the compiler that we intend
+* to use a function called show_message.
+* It has no arguments and returns no value
+* This is the "declaration".
+*
+*/
+
+void show_message(void);
+/*
+* Another function, but this includes the body of
+* the function. This is a "definition".
+*/
+int main(){
+ int count;
+
+ count = 0;
+ while(count < 10){
+ show_message();
+ count = count + 1;
+ }
+
+ return(0);
+}
+
+/*
+* The body of the simple function.
+* This is now a "definition".
+*/
+void show_message(void){
+ printf("hello\n");
+}