What is the fairly common way to implement a flag function?
I'm actually I want to implement some such as a flag function into my code.
But I'm struggling with implementation in c.
What is the fairly common way to implement a flag function?
int trigger =0;
main() {
while(1) {
switch (num)
case0
case1 :
trigger = 0
..
case6 : trigger = 1
if (trigger==1)
printf('trigger-on');
else
printf('trigger-off');
}
}
As you can see the problem of above is that if case 6 is activated, then we can see lots of '
trigger-on' printed messages.
But I want this just to do one time with trigger or flag..
What is the fairly common way to implement a flag function?
