C Programming Reference


C Programming Reference >> C Basic Tutorials >> C Keywords Home >>

gotoui

30/12/06 -  Views - Ratings :   3.48 of 5 / 155 Votes

Goto is used for jumping from one stament to another. It can also be used for generating loops. You cann't jump from one function to another. To mark a point to jump to label stament is used. Use of goto is highly discouraged in C Programming due its inherent properties of breaking the code and making it unreadable.

Code -
void function (void)
{
a = 1;
loop:;  // label stament
printf ("\n%d",a);
a++;
if (a < 10) goto loop ; // jump statement   
}

Back To Top


      

 

 

© 2006 cencyclopedia.com