I got all the errors fixed but now it is crashing. it crashes when the program reads the dictionary file
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//CONSTANTS
#define wrdlen 48
#define linelen 1024
// A struct representing a node in a binary search tree
struct BSTnode
{
char word[wrdlen];// The contents of the node
struct BSTnode* left;// Links to the node's left and right children
struct BSTnode* right;
};
// Adds a new node to the tree. Duplicates are disallowed. Returns 1 if a
// new node was added, returns 0 if newdata was already in the tree
int insert(struct BSTnode** root, char newword[wrdlen])
{
// If we've reached the right place to insert, create a new node and add it in
if( (*root) == NULL)
{
(*root) = (struct BSTnode*)malloc(sizeof(struct BSTnode));
strcpy((*root)->word,newword);
(*root)->left = NULL;
(*root)->right = NULL;
return 1;
}
// Otherwise, search for the correct place to insert
if(strcmp(newword,(*root)->word)<0)
{
return insert( &((*root)->left), newword);
}
else if(strcmp(newword,(*root)->word)>0)
{
return insert( &((*root)->right), newword);
}
// If the new data is neither less than nor greater than the the data at
// the current node, it must be equal, and duplicates are not allowed
else
return 0;
}
// Returns 1 if target is in the tree and 0 otherwise
int search(struct BSTnode* root, char target[wrdlen])
{
// An empty tree contains nothing, much less target
if(root == NULL)
return 0;
// If the current node is what we're looking for, we've found it
if(strcmp(root->word,target) == 0)
return …