#include <stdio.h> #include <string.h> typedef int (*int_fn)(int); typedef char (*string_fn)(char); void map_int(int * arr, int size, int_fn fn) { for (int i = 0; i < size; i++) { arr[i] = fn(arr[i]); } } void map_str(char * arr, int size, string_fn fn) { for (int i = 0; i < size; i++) { arr[i] = fn(arr[i]); } } int dbl(int n) { return 2 * n; } char bump_one(char c) { return c + 1; } int main(int argc, char** argv) { char str[] = "Hello 333 students!"; int x[] = {6, 22, 5, 2, 9}; int length = strlen(str); map_str(str, length, bump_one); map_int(x, length, dbl); for (int i = 0; i < length; i++) printf("%c", str[i]); printf("\n"); for (int i = 0; i < length; i++) printf("%d ", x[i]); printf("\n"); return 0; }