I have an application which has several functions in it. Each function can be called many times based on user input. However I need to execute a small segment of the code wi
You can use local static variable:
void foo() { static bool wasExecuted = false; if (wasExecuted) return; wasExecuted = true; ... }