Hi. I'm new to C programming and am taking an introductory course for this in uni. I'm working on an assignment which requires us to use Dijikstra's alg to determine the shortest route from a given origin and destination. We were given 2 route files to work with and I coded it mainly using one file. Now using the second route file, when mapped, is like 2 sections routes joined by only one path, and when testing with routes where the origin and destination are in the same section, it works. But when tested with origins and destinations in different sections, it goes into an infinite loop. However, when i tried to debug it by printing out the arrays i was using to run the alg in the beginning at the for loop, it printed it all out and it actually worked. When i took away the printf, it stopped working.
What i'm frustrated about is that how can a missing printf statement cause the code not to work?
I've only taken up programming this year and had no foundations so I'm quite stoked about it.