diff --git a/entropy.c b/entropy.c index 7b0244e..fb45c9c 100644 --- a/entropy.c +++ b/entropy.c @@ -7,6 +7,7 @@ main(int argc, char *argv[]) size_t len = 0; size_t hist[256] = {0}; int c; + int i; while ((c = getchar()) != EOF) { hist[c] += 1; @@ -14,7 +15,7 @@ main(int argc, char *argv[]) } float H = 0; - for (int i = 0; i < 256; i += 1) { + for (i = 0; i < 256; i += 1) { if (hist[i]) { float Hi = (float)hist[i]/len; H -= Hi * log2(Hi);