int xrange(int n);
int xrange(int n) {
static int i, state = 0;
switch (state) {
case 0: goto BEGIN;
case 1: goto YIELD;
case 2: return 0;
}
BEGIN:
for (i = 1; i <=n; i++) {
state =(i==n ? 2 :1);
return i;
YIELD:;
}
}
int main()
{
int i=0,j=0;
while(i=xrange(10))
{
printf("%d\n",i);
}
return 0;
}
Follow Us