summaryrefslogtreecommitdiff
path: root/33_counts/counts.c~
blob: 819726a5ae22ea9c924157b056274787e60a5984 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "counts.h"
counts_t * createCounts(void) {
  counts_t c = malloc(sizeof(counts_t));
  c.countArray = NULL;
  c.arraySize = 0;
  c.count_of_unknowns = 0;
}

void addCount(counts_t * c, const char * name) {
  if (name == NULL) {
    c.count_of_unknowns++;
    return;
  }

  for (int i = 0; i < c.arraySize; i++) {
    if (strcmp(name, c.countArray[i].string) == 0) {
      c.countArray[i].count++;
      return;
    }
  }
}
void printCounts(counts_t * c, FILE * outFile) {
  //WRITE ME
}

void freeCounts(counts_t * c) {
  //WRITE ME
}