-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutilfuncs.h
34 lines (32 loc) · 1.27 KB
/
utilfuncs.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
// Created by Hasan Yusuf Ahmed on 2/23/17.
#ifndef _UTILFUNCS_H_
#define _UTILFUNCS_H_
#include <stdio.h>
#include "stringset.h"
struct key{ //key. analogous to a key of a phone keypad
char digit; //a number 2-9
char *letters; // the array of letters associated with number
int length; //the number of letters associated with that number
};
typedef struct key Key;
struct stringArr{
char **array;
size_t length;
};
typedef struct stringArr StringArray;
char* letterToArray(char digit);
void initKey(Key *k, char digit);
void freeKey(Key *k);
void freeKeyArr(Key kArr[], int arrLen);
void initKeyArr(Key kArr[], char phoneNumber[]);
void printKeyArrStrByIndexArr(FILE *f, int indexArr[], Key keyArr[], int arrLen);
int isValidNumber(char *phoneNumber);
int internal_search(StringArray *enums, char *dictFile, char *fileout);
void initStringArrayWith7LetterWordFile(char *file, StringArray *s);
void freeStringArray(StringArray *s);
void undash(char str[8]);
void internal_enumerate(StringArray *str_arr, int indexArr[], Key keyArr[], int arrLen);
void copy_mem_by_keyArr(char *dest_str, int indexArr[], Key keyArr[], int arrLen);
int chararrcmp(register char *arr1, register char *arr2, int cmp_up_to);
stringset* initHashSetWith7LetterWordFile(char *file);
#endif // _UTILFUNCS_H_