Algorithm Visualization tool for C? - c

Are there existing algorithm visualization tool for C programs? like visualizing an execution of a C program through animated execution stack.

I recommend ddd for fancy GUI debugging visualizations. It visualizes all the data structures and makes pretty graphs and gives you access to your regular debugger.

Oracle Studio for Linux (former Sun Studio) Performance Analyzer has the timeline feature.
That is exactly an animated stack representation.
Like on this screenshot:

For C++, there are educational program visualizers that you might want to try:
VIP (Visual InterPreter), you should be able to visualize your own code by editing one of the examples on the site. Supports only a C++ subset, though.
The Teaching Machine, can be used as a Java program or an Eclipse plugin.
EDIT: Updated the The Teaching Machine link.

You can try ollydbg with the ollyflow plugin, or have a look at IDA
with its call graphing plugin (there are other plugins along these lines as well).

C Tutor - Visualize C code execution to learn C online
Is a great tool for visualizing the workflow of your C/C++ code - as well as a number of other languages. To my knowledge you cannot enter any command line arguments, but that's the only limitation I can think of. The benefits are that it is free, web based, and very intuitive.

Related

Making a GUI simulator in C

Hello StackOverflow Community,
I am writing a MicroMouse Simulator in C language. And I wanted something to visualize the way the maze is being solved like this -- http://www.youtube.com/watch?v=N9TkDgJNJso
I've been researching a way to accomplish this, but I haven't found anything with enough documentation to accomplish my goal.
I don't want to implement this using ASCII symbols, to me it doesn't look professional.
Is there any good GUI interfaces that I could use in C to help me accomplish this? And if so, how would I use it? I don't mind having to code in another language like Java or Python to accomplish my goal.
I saw the video that you want to make. After watching the video I feel you don't need a GUI library for this simulator program.
Here is a list of libraries that you can use.
1.OpenGL This is a 3D graphics API which also can be used for 2D and can be used with both c/c++
2.SDL This library is easy to understand for a beginner. For your program this library is better and can be used with both c/c++.
3.winBGIm This is same as the graphics.h that you found and can be used both c/c++ but it is only for windows.
If you are looking for GUI library then here's a short list.
1.GTK This is written in c and is a popular GUI library for c. You can find a GUI editor for gtk forms called glade which enables quick & easy development of user interfaces.
2.WxWidgets This is written in c++ so you have to use c++ rather than c.
3.FLTK
There are many more libraries besides these which you can find in google. You said
I do not mind having to code in another language like Java or Python to accomplish my goal.
Then for java you can use swing and If you are windows developer then use the windows form application in visual c++; then development of your program will be very easy.
SDL is one of candidate for C in order to make GUI Simulation. Lazyfoo is one of the best site I found for beginner.
SDL is strongly portable. It's written in C and there're a lot of documentation and tutorials.

User Interface for C-code

I've written a code in linux OS which produces prog.out as output file.
Now I've to write GUI for the code.
what are best ways to write it?
PS - I wanted to choose between Java Swings and openGL.
Which is best for writing a simple GUI and integrating it with my C- Application
Thanks in advance
OpenGL is a rendering library, not a UI toolkit. Comparing it to Swing doesn't make sense. And you can't choose Swing for a C application, unless you'd rather do the UI in Java and interact with a C "backend".
For a pure C solution, the best choice would probably be the GTK+ toolkit.
Try Anjuta...
http://projects.gnome.org/anjuta/
If you are prepared to use another language (you mention Java) then you may find C++ and Qt to be a good fit. Linking to the existing C code will be trivial and Qt works well on a great many platforms should you ever wish to support other platforms in addition to Linux.

How to program such that debugging is easy?

I am trying to develop some very complex applications based on Image processing. I use openCV extensively. However as the complexity of my programs are increasing I am finding it very difficult to debug my programs. Just for debugging I have to develop the same algorithm in Matlab alongside. The main reason for this is that even if there is any error in the matlab code the values of the variables are retained even when the code stops running or when it crashes. Since the values are there I can use different visualization tools to analyse it; like plotting it; showing it as an image. Is there any way or feature which we can implement in C such that we can approach the same kind of behavior.
To debug vision algorithms, I highly recommend to divide your algorithm to different vision steps. Interface each step as a function to a vision environment like matlab, by building your c-program as a plugin. Then program the controller part as a matlab script instead of c. This allows you to view each vision step as an image.
Edit: You can't seem to attach the visual studio plugin using the plugin method I posted, see comment.

visual c editor for kids

does anyone know of a visual programming tool that could be adapted for children (kids age 7-12) so that they can generate c programs to control device?
If controlling devices is your ultimate goal, how about LEGO Mindstorms? You can use all sorts of languages with it and they get to play with LEGO! They can start with the default language and once they understand the fundamentals they can start using some of the third-party languages, some of which are C/C-like
Another interesting language for kids is
scratch, from MIT. I don't know if it's possible to use it to control devices
I agree with Daniel about the LEGO's but another idea is to try Alice and a class mate of mine from college is trying to start a company with his brother and two sisters working on a project to teach children, or anyone for that matter, how to program. It's called Project Forge I don't know too much about it but I thought you could look into it.
If your looking for a good way to teach kids programming, take a look at LOGO.
http://www.softronix.com/logo.html
A bonus of learning LOGO, is that it has been used in a variety of robot toys. You don't need to buy these to teach your children to program, the free LOGO version suffices. Of course the robot toys are great fun as well. More information is available online, e.g. the LEGO (Mindstorm series) and Fisher Technic toys.
I am not sure if my answer is helpful, but you can use arduino IDE to program arduino boards. it is it is visual and running program is just a single click. interface is simple as hell and programming language (C based) is very simple to start with.
http://villamil.org/?p=106
although myself, I prefer emacs to program arduino (definitely overkill for kids)
It is not C/C++, but Microsoft has a free Small Basic IDE http://msdn.microsoft.com/en-us/beginner/ff384126.aspx aimed at kids. Also, the EXPRESS editions of Visual Studio are free and do support C in the IDE

How to Write a Windows Application? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm very new to programming, and I'd like to write a Windows Application. So far I've read Teach Yourself C in 24 Hours, what should I do (tutorial to read) next to accomplish my goal? Thanks
When I first started developing applications for Windows (about 15 years ago) I recall reading some very useful stuff by Charles Petzold. His more recent books are about C#, but his older books are still relevant because the Win32 API has not changed that much when it comes to the basics.
Hello, World!
Write the famous "Hello, World" program (Google it if unsure):
To output text to the console.
To output text to a dialog window.
To make the dialog appear after selecting a menu item.
Then, if you are still keen:
Write a program that allows a person to type in text into a text field. Display that text in a dialog window after clicking a button.
Save the text to a file.
Write a program to read the file and display its contents in a window.
That should get you started learning the fundamentals of what is happening when writing a Windows application.
Also, read all the links that people recommend you read, in this thread and others.
Old vs. New
Advice for learning .NET, C#, and C++ is great. Those technologies hide a lot of the boring "grunt" work for you. I still feel it is good to have an understanding of what is happening at a lower level for various reasons, including:
Learning C is applicable to more than Windows-based applications (some would argue .NET and C# are portable, which is true in theory, whereas ANSI C and Java are portable in practice).
Understanding what is hidden will allow you to avoid technical blunders and diagnose deep technical issues.
At this point it really depends on your goals. If all you want to do is write a Windows application, then use modern technologies that are better suited to such a task. If you want to write a Windows application with an understanding of how to write applications in general (not necessarily just for Windows), then keep pursuing the C path for now, and branch into other technologies as you expand your knowledge.
Depends on the application. But what you need now is to familiarize yourself with an API. APIs are basically premade functions that you use as tools to do... whatever it is the API was designed to help you do. You're looking for a graphical user interface API. Windows has its own but I recommend you use something crossplatform so your application will work on multiple platforms.
Look these up on wikipedia:
GTK+
Trolltech's QT4
They can pretty much do anything the windows API can do with the added benefit of working on multiple platforms like windows, linux, mac, etc.
http://winprog.org/tutorial/
These are pretty good for learning Win32. Charles Petzold is good resource if you can get your hands on a copy but The Forger's are free and you can have them in your hot little hands right now.
In general though you should spend some time just writting C/C++ apps that use the standard libraries first. Opening files, writing output, writing files, reading/writing stdio and get a good handle on the basics of the language first.
Looking up books on data structures, and analysis of algorithms are fundemental to any type of programming you want to do as well.
Read this.
Are you suggesting that you'd like to write a Windows desktop app in C? That's reaching back a long way. You're back in 2002, according to this.
Most people writing on Windows are using .NET, which means C++ or C#.
If you need some GUI or complex features,
You need some oriented object programming skills...
You can read some of this book serie : Head first... from O'Reilly
Head first Object-Oriented Analysis and Design
Head First Software Development
Head first C# or Java (It doesn't matter which language...)
Trolltech Qt4, it's a must, too ! Thanks CptAJ
They are very nice books for beginners... and advanced programmers too ;-)
Nice reading !
I disagree with a lot of the answers here... learning from the ground up is not a bad thing.
I wouldn't go out and make a whole app in C, but certainly making a little app in C is a good way to both learn the language and to appreciate (or more likely, detest) the win32 API.
Besides, you can't really appreciate what the newer languages/frameworks do for you if you don't experience the old painful way of doing things.
That said, recognize that there are newer languages and frameworks out there and learn them as well; particularly if you're trying to land a job.
I highly recommend theForger's Win32 API Programming Tutorial. It's very concise and easy to follow, and it's free.
While I won't say you've wasted your time learning some C, I'm guessing it's not where you're going to end up either.
If you really want to get rolling, without too much trouble, I'd highly suggest getting:
Visual Studio C# Express (it's free, and it's a great development environment)
A book on C#...Petzold is great, so a book like Programming Microsoft Windows with C# is perfect.
This should get you pretty much exactly what you want. You'll have everything you need, and Petzold starts you out very simply, and ramps you up to making interesting apps without losing you.
(You may wonder why I, and many other people are directing you to C# or other languages after you specifically said that you've already read and learned about C. This is because programming in windows using the old Win32 API is much more tedious. It is easy to quickly become overwhelmed by the sheer amount of extra chaff that has to go into it.)
At Microsoft, we have been working hard to come up with some great resources for simply creating Windows applications. Our page, Start Programming with Windows 7, will be sourced with tons of new resources for intermediate and advanced programmers.
There are two really important new learning series that we have been working on:
The Hilo Project: An application built from the ground up to show how you can develop programs that are specifically taylored to Windows 7 features using the most modern programming and application design methodologies.
The Learn to Program for Windows Module: An introduction to Windows programming written by a developer education expert at Microsoft. This module sounds more like what you are looking for, I recommend you check it out.
We're working on ways to surface learning resources as best we can on the Windows Developer Center - a collection of developer learning resources for people new to developing Windows or new to developing using the latest Windows features.
Additional guidance is coming through the new Home and Hub resources for client / Desktop applications on the MSDN homepage.
Try Ramp Up's Developer Basics, a microsoft learning road that shows stpe by stpe how to start windows programming. You can use the Visual C# Express version of Visual Studio as a development enviroment.
Read this book, Learn to Program with C#.
Then, make small projects in WPF; the best WPF book is Windows Presentation Foundation Unleashed; try that after reading the C# / beginning-programming book.
C#, the .NET Framework and WPF were created to move beyond the C Win32 API, to make it easier to create Windows applications.
If you want to make a standard Windows application, follow that path.
I would suggest using VB rather than C#. The syntax is a little friendlier, and it has all equivalent features and performance.
Why not follow the MSDN tutorials? If you don't like them try googling "VB tutorial".
http://msdn.microsoft.com/en-ca/library/hewcw458.aspx
Either VB or C# has a zillion examples of everything that can be googled. I would stick to either of these languages, if only for the "google support" alone.

Resources