]> Pileus Git - ~andy/sfvlug/blobdiff - c/src/fun.c
Add C notes.
[~andy/sfvlug] / c / src / fun.c
diff --git a/c/src/fun.c b/c/src/fun.c
new file mode 100644 (file)
index 0000000..25086a4
--- /dev/null
@@ -0,0 +1,31 @@
+#include <stdio.h>
+
+void hello_world(void)
+{
+       printf("Hello, World!\n");
+}
+
+void hello_name(char *name)
+{
+       printf("Hello, %s!\n", name);
+}
+
+void hello_hello(int n)
+{
+       printf("Hello, World!\n");
+       if (n > 1)
+               hello_hello(n - 1);
+}
+
+int main()
+{
+       hello_world();
+       printf("\n");
+
+       hello_name("World");
+       hello_name("Andy");
+       printf("\n");
+
+       hello_hello(10);
+       return 0;
+}