as

Wednesday 12 November 2014

goto Statement in C.


C provides one keyword goto which can be used to transfer the control to any logical statement. Below program will print "hello" twice as we jumped to the label called jump. Please note that label name can be any valid name.

#include<stdio.h>             
#include<stdlib.h>

void main()
{
int i=0;
jump:
printf ("hello");

if (i==0)
{
i++;
goto jump;
}

 }







No comments:

Post a Comment

Leave your valuable feedback. Your thoughts do matter to us.

Sponsored Links

Popular Posts

Comments

ShareThis