summaryrefslogtreecommitdiff
path: root/Examples/php/funcptr/example.c
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/php/funcptr/example.c')
-rw-r--r--Examples/php/funcptr/example.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Examples/php/funcptr/example.c b/Examples/php/funcptr/example.c
new file mode 100644
index 0000000..99583b7
--- /dev/null
+++ b/Examples/php/funcptr/example.c
@@ -0,0 +1,17 @@
+/* File : example.c */
+
+int do_op(int a, int b, int (*op)(int,int)) {
+ return (*op)(a,b);
+}
+
+int add(int a, int b) {
+ return a+b;
+}
+
+int sub(int a, int b) {
+ return a-b;
+}
+
+int mul(int a, int b) {
+ return a*b;
+}