]> git.sur5r.net Git - cc65/blob - test/ref/goto.c
Only for jumps, the lib uses named asm labels in branches
[cc65] / test / ref / goto.c
1 #include <stdio.h>
2
3 int main () {
4     char a[200] = "xyz";
5     int  ctr    = 0;
6 start:
7     a[ctr] = ctr + 65;
8     goto second;
9
10     {
11         char b[64] = "xxx";
12     first:
13         b[0] = ctr + 97;
14         goto safe;
15         b[0] = 'Z';
16     safe:
17         printf ("%c%c", a[0], b[0]);
18         if (ctr++ > 20)
19             goto end;
20         else
21             goto second;
22     }
23     {
24         char c[100] = "aaa";
25     second:;
26         c[0]  = '1';
27         c[99] = '2';
28         goto first;
29     }
30 end:
31     a[ctr] = '\n';
32     printf ("\n%s\n", a);
33
34     return 0;
35 }