1

Just wondering, why is the dictionary pointer passed into load a char* instead of a file pointer? Since the dictionaries to be loaded are files.

4

The parameter being passed in is not a file pointer, it's the name of the file, a text string. That name is used inside of load() to open the file pointer locally.

A pointer could be passed, but since parameters are passed by copy, it arguably makes a bit more sense to pass the file name in as a text string and let the pointer be opened locally inside the function instead of generating two file pointers (one in main() and a second to hold a copy of the pointer in load() ), particularly since the dictionary file is only used and accessed inside of load().

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

1
  • That clarifies it, thanks a lot!
    – Chris Shi
    Jul 26 '16 at 0:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .