C Programming - Converting exist function into function that uses pointers
Hey. So I have never truly been able to understand pointers and need a little help. I wrote a small program that finds the number of words in a dictionary file but then my teacher told me that I need to rewrite it so that the function reads int WordCount(struct dict_node* head). However I had idea where to begin the conversion. Any guidance would be much appreciated!
insert
Code:
int WordCount(void){
int WordCount;
char buffer[100];
FILE*fptr;
WordCount = 0;
fptr = fopen("dictionary.txt", "r"); // opens the dictionary file
//counts the number of words within the file
while(fscanf(fptr, "%s", &buffer) == 1){
WordCount++;
}
fclose(fptr); //closes the file
return WordCount;