From 29e2e93f3f32efa47e95f95260431167e228fe7a Mon Sep 17 00:00:00 2001 From: Carlos Maiolino Date: Thu, 25 Sep 2025 15:26:57 +0200 Subject: chap7: add small programs made in chap7 Signed-off-by: Carlos Maiolino --- C/HF/chap7/encrypt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'C/HF/chap7/encrypt.c') diff --git a/C/HF/chap7/encrypt.c b/C/HF/chap7/encrypt.c index 1b5ce25..6c3eccd 100644 --- a/C/HF/chap7/encrypt.c +++ b/C/HF/chap7/encrypt.c @@ -1,6 +1,13 @@ #include "encrypt.h" -typedef void (*encrypt_fn_t)(char *message); void encrypt(char *message, encrypt_fn_t encrypt_fn) { encrypt_fn(message); } + +void encrypt_arr(char *message, encrypt_arr_t fn_arr, int size) +{ + int i; + + for (i = 0; i < size; i++) + encrypt(message, fn_arr[i]); +} -- cgit v1.2.3