Is this the below C code an UB? can I access garbage value? if so,can static function make it working fine?
const char *foo_name(int x){ switch(x) { case FOO: return "foo"; case BAA: return "baa"; default: return "unknow"; } } I'm a bit confused if printf("%s\n",foo_name(FOO)); is ok according to C std.