#include <stdio.h>
// Does not handle multi yields.
void coroutine_(int i)
{
int loopLength = 8; // for loop, while loop would not need this and next line.
if(i < loopLength)
{
//First Pass
if(i == 0)
{
printf("Start\n");
}
//Body
printf("%i\n",i);
//Last pass
if(i == loopLength-1)
{
printf("End\n");
}
}
}
void coroutine()
{
static int i = 0;
coroutine_(i++);
}
int main() {
for(int a = 0; a < 20; a++)
{
coroutine();
}
return 0;
}