From 6a821910f3793b481bf0d5ad5e9b5a2e76961113 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Fri, 22 Jul 2022 17:43:01 +0200 Subject: [PATCH] created math operation function using callbacks part 2/3 --- src/lib/misc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/misc.c b/src/lib/misc.c index 64e177d..f061761 100644 --- a/src/lib/misc.c +++ b/src/lib/misc.c @@ -17,6 +17,11 @@ double multiply_cb(int a, int b) { return a * b; } double subtract_cb(int a, int b) { return a - b; } double sum_cb(int a, int b) { return a + b; } +double doMathematicalOperation(int a, int b, double (*op)(int, int)) +{ + return op(a, b); +} + int unlink_cb(const char *fpath, UNUSED const struct stat *sb, UNUSED int typeflag, UNUSED struct FTW *ftwbuf) { int rv = remove(fpath);