aboutsummaryrefslogtreecommitdiffstats
path: root/overcomplicated_loop.c
diff options
context:
space:
mode:
authorEliteTK <tomasz.kramkowski@gmail.com>2014-07-10 22:35:35 +0100
committerEliteTK <tomasz.kramkowski@gmail.com>2014-07-10 22:35:35 +0100
commita8609ccd901b1942e862c14205026d841e640add (patch)
tree5eaf1d04d454bc45acfdf4c698b2860b91f48a00 /overcomplicated_loop.c
parent922fe2f68c39a765896d274356c7c9dc4fb9cd73 (diff)
downloadc-stuff-a8609ccd901b1942e862c14205026d841e640add.tar.gz
c-stuff-a8609ccd901b1942e862c14205026d841e640add.tar.xz
c-stuff-a8609ccd901b1942e862c14205026d841e640add.zip
More stuff.
Diffstat (limited to 'overcomplicated_loop.c')
-rw-r--r--overcomplicated_loop.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/overcomplicated_loop.c b/overcomplicated_loop.c
new file mode 100644
index 0000000..a843a8a
--- /dev/null
+++ b/overcomplicated_loop.c
@@ -0,0 +1,27 @@
+#include <setjmp.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+static jmp_buf env;
+
+int main (void)
+{
+ srand(time(NULL));
+ int a = 0;
+ while (a == 0) {
+ a += rand() * time(NULL);
+ float c = 1 / a;
+
+ for (int b = 20; !setjmp(env); b -= 21) {
+ if ((a / b) < 20)
+ c *= c;
+
+ if (c == a)
+ longjmp(env, 0);
+ /*
+ * Your code here.
+ */
+ }
+ }
+}