We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0127592 commit fab1e79Copy full SHA for fab1e79
c/misc/goto_in_c.c
@@ -0,0 +1,33 @@
1
+
2
+#include <stdio.h>
3
4
+#define A 1
5
+#define B 0
6
+#define C 0
7
8
+int main() {
9
+ // fail switch
10
+ if (!A) {
11
+ goto exit;
12
+ }
13
+ if (!B) {
14
+ goto restart_B;
15
16
+ if (!C) {
17
+ goto restart_C;
18
19
+ // no fails
20
+ return 0;
21
22
+restart_B:
23
+ printf("%s\n", "restarting B");
24
25
+restart_C:
26
+ printf("%s\n", "restarting C");
27
28
+exit:
29
+ printf("%s\n", "exiting");
30
31
+ // some fails
32
+ return -1;
33
+}
0 commit comments