[C]goto statement, rarely been used. Deprecated???
#include <stdio.h>
int main()
{
int a = 0;
while (a < 10){
printf("a is %d
", a);
if ( a == 5)
goto OUT;
a++;
}
OUT:
printf("We're out of the loop.
");
return0;
}
运行结果为:
a is0
a is1
a is2
a is3
a is4
a is5
We're out of the loop.