summaryrefslogtreecommitdiff
path: root/Examples/chicken/simple/example.c
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/chicken/simple/example.c')
-rw-r--r--Examples/chicken/simple/example.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/Examples/chicken/simple/example.c b/Examples/chicken/simple/example.c
new file mode 100644
index 0000000..f2b0747
--- /dev/null
+++ b/Examples/chicken/simple/example.c
@@ -0,0 +1,24 @@
+/* Simple example from documentation */
+/* File : example.c */
+
+#include <time.h>
+
+double My_variable = 3.0;
+
+/* Compute factorial of n */
+int fact(int n) {
+ if (n <= 1) return 1;
+ else return n*fact(n-1);
+}
+
+/* Compute n mod m */
+int my_mod(int n, int m) {
+ return (n % m);
+}
+
+
+char *get_time() {
+ long ltime;
+ time(&ltime);
+ return ctime(&ltime);
+}