summaryrefslogtreecommitdiff
path: root/trunk/Examples/ruby/pointer/example.c
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/Examples/ruby/pointer/example.c')
-rw-r--r--trunk/Examples/ruby/pointer/example.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/trunk/Examples/ruby/pointer/example.c b/trunk/Examples/ruby/pointer/example.c
new file mode 100644
index 000000000..b877d9a5b
--- /dev/null
+++ b/trunk/Examples/ruby/pointer/example.c
@@ -0,0 +1,16 @@
+/* File : example.c */
+
+void add(int *x, int *y, int *result) {
+ *result = *x + *y;
+}
+
+void sub(int *x, int *y, int *result) {
+ *result = *x - *y;
+}
+
+int divide(int n, int d, int *r) {
+ int q;
+ q = n/d;
+ *r = n - q*d;
+ return q;
+}