Skip to content

Instantly share code, notes, and snippets.

@lucasscariot
Created October 25, 2016 10:03
Show Gist options
  • Save lucasscariot/e7e66c74f3702c59501a56ad6c664a1e to your computer and use it in GitHub Desktop.
Save lucasscariot/e7e66c74f3702c59501a56ad6c664a1e to your computer and use it in GitHub Desktop.
struct s_flags
{
char flag;
int (*p)(int a, int b);
};
typedef struct s_flags t_flags;
t_flags flags[]= {
{'d', is_d},
{'i', is_i},
};
#define TAB_SIZE(x) (sizeof(x) / sizeof(x[0]))
char c = 'i';
while (i < TAB_SIZE(flags))
{
if (c == flags[i].flag)
flags[i].p(inta, intb);
i++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment