i get following with File->Preferences->compiler warnings set to "more"
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino: In function 'void setup()':
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino:10:5: warning: label 'case1' defined but not used [-Wunused-label]
case1:
^~~~~
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino:13:5: warning: label 'case2' defined but not used [-Wunused-label]
case2:
^~~~~
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino:16:5: warning: label 'case3' defined but not used [-Wunused-label]
case3:
^~~~~
Sketch uses 4568 bytes (14%) of program storage space. Maximum is 32256 bytes.
Global variables use 236 bytes (11%) of dynamic memory, leaving 1812 bytes for local variables. Maximum is 2048 bytes.
As the warnings produced when compiling the code say
C:\Users\micro\AppData\Local\Temp\.arduinoIDE-unsaved2025918-17880-isaf1l.crxap\sketch_oct18a\sketch_oct18a.ino: In function 'void setup()':
C:\Users\micro\AppData\Local\Temp\.arduinoIDE-unsaved2025918-17880-isaf1l.crxap\sketch_oct18a\sketch_oct18a.ino:12:1: warning: label 'case1' defined but not used [-Wunused-label]
C:\Users\micro\AppData\Local\Temp\.arduinoIDE-unsaved2025918-17880-isaf1l.crxap\sketch_oct18a\sketch_oct18a.ino:15:1: warning: label 'case2' defined but not used [-Wunused-label]
C:\Users\micro\AppData\Local\Temp\.arduinoIDE-unsaved2025918-17880-isaf1l.crxap\sketch_oct18a\sketch_oct18a.ino:18:1: warning: label 'case3' defined but not used [-Wunused-label]
It contains some strange labels, which are not used (case1, case2, case3), but it is allowed and legal, so it issues just warnings.
It contains some code, and it is also allowed.
The value of sx was not met in any case inside (because there are no cases inside, but it is also allowed) and there is no default, so nothing is executed inside, excactly as C++ was specified.
So the switch compiles and works exactly as you wrote it. (And in totally different way, than you want it. It is what computers do all the time )
so based on that definition, the statement (typically a compound statement) can contain code outside any case or default label and this is legit.
But the spec states as well
When the condition of a switch statement yields a (possibly converted) value:
If one of the associated case label constants has the same value, control is passed to the statement labeled by the matched case label.
Otherwise, if there is an associated default label, control is passed to the statement labeled by the default label.
Otherwise, none of the statements in the switch statement will be executed.
➜ Any code in the switch block that is not part of a case or default label will end up being ignored (unreachable when a matching case exists unless control happens to fall through from a previous case).
Any code that has no case label can't be "fall[en] through" to... it's part of the "previous case".
So except for traditionally unreachable code, only the first statements in the { } of the switch, if keft without the case label, woukd be unreachable.
That is what OP wanted, but not what he wrote You have put unconditional goto end1; before the goto* to reflect, that he did not used the jump labels anywhere
Then the solution would be to switch 'verbose' on, not using arrays and pointers to circumvent a problem that could have been solved with a few spaces.