-
-
Save jammy-dodgers/521e0e41ad8e042d19412a39484a2dcb to your computer and use it in GitHub Desktop.
pre-processed output for https://gist.github.com/jammy-dodgers/c9ffce1de8efeff767a84027bb34e5f1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Fibonacci | |
{ | |
int pos; | |
int current; | |
int n1; | |
int n2; | |
}; | |
struct Fibonacci new_Fibonacci() | |
{ | |
struct Fibonacci gener_temp_init_var; | |
gener_temp_init_var.pos = 0; | |
return gener_temp_init_var; | |
} | |
int Fibonacci_has_next(struct Fibonacci *vars) | |
{ | |
switch (vars->pos) | |
{ | |
case 0: | |
{ | |
vars->n1 = 0; | |
vars->n2 = 1; | |
while (vars->n1 < 10000) | |
{ | |
int tmp = vars->n1; | |
vars->n1 = vars->n2; | |
vars->n2 = tmp + vars->n2; | |
vars->current = (tmp); | |
vars->pos = 1; | |
return 1; | |
case 1:; | |
} | |
}; | |
return 0; | |
} | |
return 0; | |
} | |
int main() | |
{ | |
struct Fibonacci f; | |
f = new_Fibonacci(); | |
{ | |
struct Fibonacci foreach_loop_var; | |
foreach_loop_var = f; | |
while (Fibonacci_has_next(&foreach_loop_var)) | |
{ | |
int i = foreach_loop_var.current; | |
{ | |
printf("%d\n", i); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment