http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
goto                     goto Statement

 goto label;

    The "infinitely-abusable goto statement" causes an unconditional jump
    to a named label.

      Notes:    Any statement may have a label, however, labels are only
                recognized by the goto statement. A label must be
                followed by a statement, even if it is only the null
                statement.

                You cannot jump to a switch's `case' or `default' labels.

                Statement labels within a function must be unique.

                While many might consider it an unspeakably ugly
                programming practice, it is possible to jump into a
                compound statement or switch.

  -------------------------------- Example ---------------------------------

           for (i = 0; i < imax; ++i)
                   for (j = 0; j < jmax; ++i)
                       if (table[i][j] == value)
                           goto found;

               printf("Can't find value in table\n");
               exit(1);

           found:   statement;

See Also: label

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson