Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visualizing C++ to help understanding it

Tags:

c++

I'm a student who's learning C++ at school now. We are using Dev-C++ to make little, short exercises. Sometimes I find it hard to know where I made a mistake or what's really happing in the program. Our teacher taught us to make drawings. They can be useful when working with Linked Lists and Pointers but sometimes my drawing itself is wrong.

(example of a drawing that visualizes a linked list: nl.wikibooks.org/wiki/Bestand:GelinkteLijst.png )

Is there any software that could interpret my C++ code/program and visualize it (making the drawings for me)? I found this: link text

other links: cs.ru.ac.za/research/g05v0090/images/screen1.png and cs.ru.ac.za/research/g05v0090/index.html

That looks like what I need but is not available for any download. I tried to contact that person but got no answer.

Does anybody know such software? Could be useful for other students also I guess...

Kind regards,

juFo

like image 551
juFo Avatar asked Jan 22 '23 23:01

juFo


2 Answers

This is unrelated to the actual title but I'd like to make a simple suggestion concerning how to understand what's happening in the program.

I don't know if you've looked at a debugger but it's a great tool that can definitely vastly improve your understanding of what's going on. Depending on your IDE, it'll have more or less features, some of them should include:

  • seeing the current call stack (allows you to understand what function is calling what)
  • seeing the current accessible variables along with their values
  • allowing you to walk step by step and see how each value changes
  • and many, many more.

So I'd advise you to spend some time learning all about the particular debugger for your IDE, and start to use all of these features. There's sometimes a lot more stuff then simply clicking on Next. Some things may include dynamic code evaluation, going back in time, etc.

like image 102
JRL Avatar answered Jan 26 '23 01:01

JRL


Have a look at DDD. It is a graphical front-end for debuggers.

Try debuggers in general to understand what your program is doing, they can walk you through your code step-by-step.

like image 36
Juri Glass Avatar answered Jan 26 '23 01:01

Juri Glass