'fscanf' changing pointer to struct in C

0

Good evening.

I was writing a program to read strings from a text file, and place these in a simply linked list if its length was equal to 5.

The problem is that the program started not working the way I did I expected, and after a few tests, I discovered that a pointer I was using it would point from nothing to another memory address, after some iterations and an 'fscanf' command.

I put in Pastebin the test code I wrote: link

The "keys.txt" file contains the following strings:

m4mSx
fr4
mWKgC
7bbak
7
NP3Rw

I wrote another code that solves without problems what I wanted to do, but I would like to know why this error is happening with this test code, since from what I know it does not make sense that this is happening.

    
asked by anonymous 29.04.2017 / 03:55

0 answers