0

Call a Function when checking case in switch statement

Is it possible to call a function during case check in switch statement!? bool Function (); int main () { switch (false) { case "Function ()" : printf ("\n Function Called!"); break; default : printf ("\n "); } }

25th Dec 2020, 2:54 PM
H. Ahmadian
H. Ahmadian - avatar
4 Respuestas
+ 3
Edited: Yes, H. Ahmadian. That's what I meant. You mighr want to check this out: https://stackoverflow.com/a/14069771
26th Dec 2020, 12:06 AM
Kevin ★
+ 1
As I recall (cmiiw), const char* isn't supported as an evaluation subject in `switch` cases (C language tagged).
25th Dec 2020, 3:07 PM
Ipang
+ 1
Kevin ★ I didn't get it!!! You mean i mustn't surround function call with quotes!? Because i did so, if you see the code more careful
26th Dec 2020, 12:14 AM
H. Ahmadian
H. Ahmadian - avatar
0
No one have any idea!!? 🙆
25th Dec 2020, 4:34 PM
H. Ahmadian
H. Ahmadian - avatar