Tuesday, September 9, 2025

Cool way to teach C, C++ or Python with online debug and memory visualization

    This all started when I was trying to teach basics of C and Functions to a school kid. I was actually searching for a quick  online debugger for C/C++ so that I can show the program flow to the kid and explain how the program flow works through the function calls. This is when I found the website https://pythontutor.com/. Dont let the site name discourage you its not limited to python, the site actually support debug of C, C++, Python, JavaScript, Java code.

    Not only this website gives some sample programs to see execution and memory visualization but we can also input our own programs in the site and execute them step by step to teach the new comers how exactly program flow and variable storage works. It also works good with pointers and show proper visualization of pointers and its values etc. Well they say a picture speaks a thousand words so I will share a screenshot from the website now.



    I liked the way it showed the character array in visual to demonstrate how it would be stored in the memory. This site also has experimental feature of AI Tutor where you can ask question about the code and AI Tutor will try to explain the code.


The AI Tutor gives the explanation of code line by line or with key take away etc. When I selected "Teach me about a key concept that this code demonstrates" I saw following type of result...


This is quiet good from the perspective of teaching a new comer. So overall I liked this idea implemented by the website pythontutor.com very much. It helps a lot to teach programming to new comer kids.

No comments: