A table of function pointers can group related module operations.

Dispatch Table

dispatch_table.c
#include <stdio.h>

static int add_two(int value) {
    return value + 2;
}

static int times_three(int value) {
    return value * 3;
}

int main(void) {
    int useTriple = ;
    int value = ;
    int (*ops[2])(int) = {add_two, times_three};
    int result = ops[useTriple](value);

    printf("result=%d\n", result);
    return 0;
}
#include <stdio.h>

static int add_two(int value) {
    return value + 2;
}

static int times_three(int value) {
    return value * 3;
}

int main(void) {
    int useTriple = ;
    int value = ;
    int (*ops[2])(int) = {add_two, times_three};
    int result = ops[useTriple](value);

    printf("result=%d\n", result);
    return 0;
}
#include <stdio.h>

static int add_two(int value) {
    return value + 2;
}

static int times_three(int value) {
    return value * 3;
}

int main(void) {
    int useTriple = ;
    int value = ;
    int (*ops[2])(int) = {add_two, times_three};
    int result = ops[useTriple](value);

    printf("result=%d\n", result);
    return 0;
}
#include <stdio.h>

static int add_two(int value) {
    return value + 2;
}

static int times_three(int value) {
    return value * 3;
}

int main(void) {
    int useTriple = ;
    int value = ;
    int (*ops[2])(int) = {add_two, times_three};
    int result = ops[useTriple](value);

    printf("result=%d\n", result);
    return 0;
}
operation table Each table entry names one operation and the function that implements it.
selected behavior Changing an index selects a different function through the same call shape.