I have watched screen cast of few red coders like SecondThread and i have seen that they debug just by looking at code . I usually use GDB for c++ for debugging. I wanted to know what are different possible ways to debug our program without using any print statement or any other tool like GDB.
Also i have to debug a lot . Is there some way to improve in this regard ?
With enough practice you'll be able to tell exactly what your code does just by reading it. That's all that's happening it's the same way you would read a book in another language. You'll have to get good at the language to understand it without help
I also add print statements to binary search where the problem is. If you have a break case and you know your code should get it right but isn’t, you can trace through it with print statements to find your typo if you don’t see it just by looking. It’s definitely a good skill to have, especially when you’re just starting. Once programs hit a certain complexity they are so long that you can’t always just see the bug by reading code.