•  Back 
  •  C Language 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : C-Language Documentation
Author      : John Kormylo
Version     : C.HYP 1.0
Subject     : Documentation/C-Language
Nodes       : 233
Index Size  : 6362
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : en
@default    : 
@help       : Help
@options    : +g -i -s +x +z -t4
@width      : 75
View Ref-File[ goto ]

Syntax:
<label>:                    or                 goto <label>;
  ...                                          ...
  goto <label>;                              <label>:

where <label> is a valid name.
(Note the use of colon instead of semicolon).

While the use 'goto' is discouraged, there are certain things which
are almost impossible (or at least very repetitive) to do otherwise.
The most common use is for error handling:

  if( ferror(fd) ) goto error;
  ...
  if( ferror(fd) ) goto error;
  ...
  return(0);

error:
  err = ferror(fd);
  fclose(fd);
  printf("I/O error #%d \n", err);
  return(err);
 }