Sunday, 7 August 2016

GOTO STATEMENT

#include <stdio.h>
int main ()
{
 int a = 10;   /* local variable definition */
 LOOP:    /* Label */
 do    /* do loop execution */
 {
  if( a == 15)
  {
   a = a + 1;
   goto LOOP; /* skip the iteration and going exicution to label*/
  }
  printf("value of a: %d\n", a);
  a++;
 }while( a < 20 );
 return 0;
}

output :
value of a: 10
value of a: 11
value of a: 12
value of a: 13
value of a: 14
value of a: 16
value of a: 17
value of a: 18
value of a: 19

No comments:

Post a Comment

smhjifrivly@gmail.com