aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2013-10-31 15:02:22 -0400
committerCalvin Morrison <mutantturkey@gmail.com>2013-10-31 15:02:22 -0400
commit8784d26bf275128935a1f682fab6cfff30d2e15b (patch)
treedbeb94baede91a0eda97f08b271347d7ebd52023
parent4b88414b27394a188cfcac6abc366b6a5a6b766c (diff)
fix memset
-rw-r--r--kmer_frequency_per_sequence.c11
1 files 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);