Call a function named in a string variable in C

C does not support this kind of operation (languages that have reflection would). The best you’re going to be able to do is to create a lookup table from function names to function pointers and use that to figure out what function to call. Or you could use a switch statement.

Leave a Comment