I had a question for dictionary.c. First, I'm still confused at why load and check imput is const char*. I understand that const char* means that the value that char* points to will never change and that load and check should not be changing the value. But would it not still not work you make the parameter char* only? Can someone explain what could go wrong/ give an example? My second question is when I am declaring a hashtable, why do I need to declare it like node* hashtable[SIZE]? Wouldnt node hashtable[SIZE] still point to the memory address of the first node because arrays automatically do that?
Also can someone explain what this line means: while(fscanf(fp,"%s\n",word) != EOF). I understand EOF is end of file, and fscanf takes in file to be read, what to read, and where to output what is read. But I'm confused on how fscanf works in this case. First, does it = EOF when fscanf reads /0? Also how does it know when to stop/ why does it only take a word with %s\n (instead of the whole dictionary). What is "word" anyways. Is this saving it into the char* word i declared when i created the struct for a node? Sorry if this is a rudimentary question but if you can provide a thorough explaination on fscanf or provide a helpful video, thatd be appreciated.
Also, one more random question, but for http://www.cplusplus.com/reference/cstring/strcpy/ the example here: char str1[]="Sample string"; char str2[40]; char str3[40]; strcpy (str2,str1); strcpy (str3,"copy successful");
Why is it declaring an array and setting the whole array equal to a string? That's what char str1[] char str2[40] is right? Arrays and the second on being size 40. Does char str1[] = "Sample string" set each array index a character from Sample String? Why does it do that if yes?
Thanks