# include <stdio.h>
# include<time.h>
# include <limits.h>
int main() {
clock_t start;
long a = 0;
long b = 0;
start = clock();
for (int i = 0; i < INT_MAX; i++) {
for (int j = 0; j < INT_MAX; j++) {
for (int k = 0; k < INT_MAX; k++) {
for (int q = 0; q < INT_MAX; q++) {
b = 1;
}
}
}
}
printf("%.5f\n", ((float)(clock() - start) / CLOCKS_PER_SEC));
start = clock();
for (int i = 0; i < INT_MAX; i++) {
for (int j = 0; j < INT_MAX; j++) {
for (int k = 0; k < INT_MAX; k++) {
a = 0;
for (int q = 0; q < INT_MAX; q++) {
a += 1;
}
}
}
}
printf("%.5f\n",((float)(clock()-start)/CLOCKS_PER_SEC));
}
When I run in release mode, this shows the result immediately. But when I run in Debug mode, it's not over.
I know that release mode is fast, but how can it be so fast?