From 8784d26bf275128935a1f682fab6cfff30d2e15b Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Thu, 31 Oct 2013 15:02:22 -0400 Subject: fix memset --- kmer_frequency_per_sequence.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/kmer_frequency_per_sequence.c b/kmer_frequency_per_sequence.c index 7c1bf9b..2d02403 100644 --- a/kmer_frequency_per_sequence.c +++ b/kmer_frequency_per_sequence.c @@ -43,7 +43,7 @@ int main(int argc, char **argv) { unsigned long total = 0; // reset our count matrix to zero - memset(counts, 0, width); + memset(counts, 0, width * sizeof(unsigned long long)); for(i = 0; i < read - kmer; i++) { line[i] = alpha[(int)line[i]]; @@ -53,17 +53,14 @@ int main(int argc, char **argv) { counts[num_to_index(&line[i],kmer, width)]++; } - for(i = 0; i < width; i++) - total += counts[i]; - for(i = 0; i < width - 1; i++) - printf("%.12f\t", (double)counts[i] / total); - printf("%.12f\n", (double)counts[width - 1] / total); + printf("%llu\t", counts[i]); + printf("%llu\n", counts[width - 1]); - free(counts); } } + free(counts); free(line); -- cgit v1.2.3