-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.h
47 lines (33 loc) · 796 Bytes
/
map.h
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// map.h
//
// This is a basic map data structure for key, value pairs of strings.
// Simplicity is favored over efficiency. Map lookups use linear search.
//
//
// Code for Clark University CSCI 140 assignments.
//
// Author: John Magee
// Date: 10/5/2017
// Version 1.0
//
#ifndef MAP_H_INCLUDED
#define MAP_H_INCLUDED
#define STR_LENGTH 40
typedef struct {
char *key;
char *value;
} stringpair;
typedef struct {
int mapSize;
int maxSize;
stringpair* pairs;
} mapstruct;
typedef mapstruct* map;
// function definitions
map createMap(int maxSize) ;
void freeMap(map currentMap);
int containsKey(map aMap, char *searchKey);
char* lookupIndex(map aMap, int i) ;
char* lookupKey(map aMap, char *searchKey);
int insertKey(map aMap, char* key, char *value);
#endif