Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* open */
- fileptr = fopen(filename, "r");
- /* check for errors opening */
- if(!fileptr){
- printf("Error opening file.");
- }
- /* get the word */
- /* while the input is not at the end */
- char *pos = (char *)malloc(sizeof(char));
- while((pos = getWord(fileptr)) != NULL){
- /* Instruction One: Read in word. Print for verification */
- printf("%s", pos);
- /*Instruction Two: If word is in the hash table, increment occurrences */
- if(containsKey(hashTable, pos)){
- int val= *atMap(hashTable, pos);
- val++;
- }
- /*instruction Three: If it's not in the hash table, insert it with occurence amount of one */
- else{
- insertMap(hashTable, pos, 1);
- }
- /* since it's in the while, should inc automatically */
- }
- /*... concordance code ends here ...*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement