This time I am wondering whether creating a structure like:
Code: Select all
struct commands
{
char command = "example"
(*func_ptr[option])();
}
On the other hand I am also thinking about simple if if if if...
Thanks for advices.
Code: Select all
struct commands
{
char command = "example"
(*func_ptr[option])();
}
Your struct looks a bit funny. Is that supposed to be "char *" instead of "char"? What kind of function pointer declaration is that?verynewbienoob wrote:Code: Select all
struct commands { char command = "example" (*func_ptr[option])(); }
Will you be adding or removing commands at runtime? If yes, a binary search tree will have better performance while using a similar amount of memory. If no, a sorted array and a binary search will have better performance while using a similar amount of memory.verynewbienoob wrote:linked list
Yes, that is supposed to be pointer to char.Octocontrabass wrote:Your struct looks a bit funny. Is that supposed to be "char *" instead of "char"? What kind of function pointer declaration is that?verynewbienoob wrote:Code: Select all
struct commands { char command = "example" (*func_ptr[option])(); }
Will you be adding or removing commands at runtime? If yes, a binary search tree will have better performance while using a similar amount of memory. If no, a sorted array and a binary search will have better performance while using a similar amount of memory.verynewbienoob wrote:linked list