I've got the following structure:
Code:
struct word
{
char theWord[30];
int count;
};
struct word arr[15000];
However, I can't get this for loop to work properly:
Code:
for (i=0;strcmp(arr[i].theWord,NULL)!=0 && dupeFlag!=1;i++)
{
printf("hi %s is the word, %s is temp\n",arr[i].theWord,temp);
if (strcmp(arr[i].theWord,temp)==0)
dupeFlag=1;
}
//I've also tried, in place of "strcmp(arr[i].theWord,NULL)!=0": arr[i].theWord[0]!='\0', and so on.
//I don't want to initialize all 15000 arr[x].theWord's to NULL, so is there a way I can detect if they are garbage values or not? This currently gives me a segmentation fault.
By the way, I'm not allowed to use C++. Can't post the whole code since we get an F if our codes look similar... makes sense but its a bit annoying.