Answer the question
In order to leave comments, you need to log in
How to improve the given C code?
How to make this code faster/better?
I want to make the code faster than it is now, if possible.
#include <time.h>
#include <stdio.h>
#include <stdio.h>
#pragma warning(disable : 4996)
#pragma warning(disable : 4552)
#pragma warning(disable : 4013)
int main() {
int start = clock(); int a = 1000; int b = 0, c = 0; int d = 1;
FILE* f;
while ("") {
for (c < d; a > b; b++) {
f = fopen("2200.txt", "a");
fprintf(f, "\ntext");
fclose(f);
}
for (c < d; a = b; c++) { b = 0; }
if (c == d) {
double elapsed = (clock() - start) / 1000.0;
printf("\nTime elapsed in ms: %f", elapsed);
getch();
}
}
}
Answer the question
In order to leave comments, you need to log in
for (c < d; a > b; b++)
replace with
for (;c < d, a > b; b++)
and also
for (c < d; a = b; c++)
replace with
for (;c < d,a == b; c++)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question