Post before suggests that there was some problem with
I malloc dict_word now. However, it still is not loading regarding to vangrid. Coud you possibly share your thoughts?
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.Sign up to join this community
I think the problem could be with your dict_word, you have a pointer to a char (char*) and you're pointing it at a block of allocated memory which is also the size of a pointer to a char (the block of memory would really want to be size char, not char*). I think you're then tying to store a whole string into that pointer. Even if you change your malloc size to char, it will only be space for one character.
A way around this is for you is to either dynamically allocate the memory for each character read from file until you reach the end of a word. Or as we know a word cannot be longer than LENGTH (45 characters as specified in dictionary.h) you can allocate memory for each word as char * LENGTH+1 (the +1 for the null terminator). In this case the memory isn't being allocated dynamically and therefore you could actually declare it as an array on the stack.