Alright, look at this:
Example:
Code:
#include <math.h>
#include <stdio.h>
typedef float (*function_1arg)(float);
struct math_func
{
char name[64];
function_1arg function;
};
struct math_func funcs[] =
{
{"sin", sinf},
{"cos",cosf},
{"sqrt",sqrtf},
{"exp",expf}
};
// You can handle the parsing part of your code yourself bud, but from here you'd do something
// like
if(stricmp(opcode, funcs[i].name) == 0)
funcs[i].function(atof(operand));
In my pseudo code part assume that opcode and operand are buffers containing the name of the function and the value which they are working with (respectively) and you are looping with i through the funcs array.