I want to create a function that will enable or disable the some parts of the functions with conditions. I have created a struct that contains 4 members (enum types, uint8 catNumber, char Name, bool flag).
typedef struct MYSTRUCT
{
enum modes;
uint8 catNumber;
char name;
bool flag;
}mystruct;
Enum contains:
typedef emum MODES {mode1, mode2, mode3}modes;
So after creating a struct template, I have declare a array variable of struct type. i.e. Struct mystruct variable[3]. And I have initialized the each member of mystruct.
mystruct Variable[3] =
{
[0] ={.modes=mode1,
.catNumber=1,.name = “catA”,
.flag=false},
[1] = {.modes =mode2,
.catNumber=2,.name = “catB”,
.flag=false},
[2] = {.modes =mode3,
.catNumber=3,.name = “catC”,
.flag=false},
};
So the user has to enter the category number and the true/false Flag to enable or disable the part of the function i.e different categories from struct and with each corresponding mode print a mode name to check it is enable. So the task is the user can enable one or more than one category. For eg . User enters: 1 2 true. Which enables the both categories 1 and 2.
Could anyone guide me how do I do this task? And is it possible not to pass the whole struct data type as an func argument. I just want to declare pointers as an argument to point struct array elements in main().