Alex Rivera | Logout

What type of programs are best written in C

Asked 2009-01-12T15:51:14.283
27

Joel and company expound on the virtues of learning C and how the best way to learn a language is to actually write programs using that use it. To that effect, which types of applications are most suitable to the C programming language?

Edit: I am looking for what C is good at. This likely does not coincide with the best way of learning C.

c
Edit
Report

6 Answers

11

Small apps that don't have a UI, especially when you're trying to learn.

Edit: After thinking a little more on this, I'd add the following: if you already know a higher-level language and you're trying to learn more about C, a good route may be to not create a whole new C app, but instead create a C DLL and add functions to it that you can call from the higher language. In this way you can replace simple functions that your high language already has to ensure that you C function does what it should (gives you pre-built testing), lets you code mostly in what you're familiar with, uses the language in a problem you're already familiar with, and teaches you about interop.

answered 2009-01-12T15:54:15.120
6

A bootloader. Some assembly also required, which is actually very nice..

answered 2009-01-12T16:11:24.057
1

examples are: embedded apps, kernel code, drivers, raw sockets.

However if you find yourself more productive in C then go ahead and build whatever you wish. Use the language as a tool to get your problem solved.

answered 2009-01-12T22:45:26.740
0

Don't treat C as a beefed up assembler. I've done some serious app's in it when it was the natural language (e.g., the target machine was a Solaris box with X11).

Write something with some meat on it. Write a client server chess program, where the AI is on a server and the UI is displaying in X11; once you've done that you will really know C.

answered 2009-01-12T16:02:52.997
0

Any place where the underlying libraries are entirely in C is a good candidate for staying in C - openGL, Lua extensions, PHP extensions, old-school windows.h, etc.

answered 2009-01-12T21:13:02.560
0

I prefer C for anything like parsing, code generation - anything that doesn't need a lot of data structure (read OOP). It's library footprint is very light, because class libraries are non-existent. I realize I'm unusual in this, but just as lots of things are "considered harmful", I try to have/use as little data structure as possible.

answered 2009-01-12T22:54:19.423

Your Answer