Das Oracle
March 14th, 2006, 03:06 PM
Here is any relevant code:
typedef struct{
char* word;
int score;
}tword;
tword* dictionary=NULL;
fscanf(ifp,"%d",&size);
dictionary = malloc(size*sizeof(tword));
for(index=0;index<size;index++){
fscanf(ifp,"%s",dictionary[index].word);
}
the problem is that when i try to print the words out like this:
for(index=0;index<size;index++)
printf("%s\n",dictionary[index].word);
the output is null any ideas why?
typedef struct{
char* word;
int score;
}tword;
tword* dictionary=NULL;
fscanf(ifp,"%d",&size);
dictionary = malloc(size*sizeof(tword));
for(index=0;index<size;index++){
fscanf(ifp,"%s",dictionary[index].word);
}
the problem is that when i try to print the words out like this:
for(index=0;index<size;index++)
printf("%s\n",dictionary[index].word);
the output is null any ideas why?