Code:
#include <stdio.h>
//#include <iostream.h>
#include <string.h>
#include <malloc.h>
//#include <string> --cpp only
Please make up your mind as to whether you're compiling C or C++.
If it's C, then you need to
a) stop casting malloc
b) #include <stdlib.h>
There is no standard header called malloc.h
Code:
lino = (char*)malloc(sizeof(line));
while((lino = fgets(line, sizeof(line), inputFile))){
This is just a memory leak - there is no need to allocate anything to lino
In fact, it's a useless variable, since you may as well just write
Code:
while( fgets(line, sizeof(line), inputFile) ) {
insertToTree(line);
printf(line);
}
>
Code:
int isEmpty( )
{
int TRUE = 5;
int FALSE = 0;
if (root == NULL)
return TRUE;
else
return FALSE;
}
What an utterly bizarre value for true - most people (and the language) use the value 1.
This function can be reduced to
Code:
int isEmpty( )
{
return root == NULL;
}