by Dinesh Thakur Category: Control Structures

C has GOTO statement but one must ensure not to use too much of goto statement in their program because its functionality is limited and it is only recommended as a last resort if structured solutions are much more complicated. First let us see what the goto statement does, its syntax and functionality. The goto is a unconditional branching statement used to transfer control of the program from one statement to another.

Syntax of goto statement is:

goto       namel;
………….. ………….
…………. ………….
…………. ………….

Here in the goto the name1 mentioned identify the place where the branch is to be made. The name1 is a valid variable name followed by a colon. The name1 is placed immediately before the statement where the control is to be transformed. A program may contain several goto statements that transferred to the same place when a program in which case the names mentioned in goto must be unique for branching.


Control can be transferred out of or within a compound statement, and control can be transferred to the beginning of a compound statement. However the control cannot be transferred into a compound statement.


Thus one must take care not to use too much of goto statements in their program or in other words use it only when needed. This is because C being a highly structured language one must take care not to use too much of these unconditional goto branching statements which makes the program a poor way of coding.


The goto statement is discouraged in C, because it alters the sequential flow of logic that is the characteristic of C language. This word is redundant in C and encourages poor programming style.


About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles