I'm trying to do something like this in C++:
if(){
int a;
} else if(){
char a;
} else {
double a;
}
f(a);
But I get an error from the compiler saying that a was not declared in this scope. I need to do a conditional declaration, how can I do it?
Many thanks
edit: I cannot move the function inside the conditional as the problem is bigger: f(a,b,c); where a, b and c need to be declared in this way.