I have written this code:
#include <stdio.h>
int main() {
printf("Works");
int base = 1;
do {
if (base > 1) {
for (int i = 0; i <= base; i++) {
if ((base % i) == 0) {
break;
} else {
printf("%d ", base);
}
}
}
base += 1;
} while (1);
return 0;
}
It compiles perfectly, but when I run it the terminal just closes, I have no idea how to debug this, as I am very new to making programs in c.
Edit: This is supposed to generate primes forever.