I'm a java programmer, wishing to learn C. I want to learn about memory management, making my own data structures, so when asked in interviews, I may be better prepared.
To begin with, what IDE, if any, would you recommend? Thanks
I'm a java programmer, wishing to learn C. I want to learn about memory management, making my own data structures, so when asked in interviews, I may be better prepared.
To begin with, what IDE, if any, would you recommend? Thanks
If you are in Windows, you can get a free copy of Visual Studio C++ 2008 Express.
I would use a combinaltion of gedit (or your favorite text editor w/ syntax highlighting) and gcc.
If you are on a Windows machine I would use CygWin to get access the the gcc compiler. And then use notepad++ for your text editor.
Keep it simple at first. You can move to a more complex IDE after you get the basics down.
Also, for quick reference keep cplusplus.com close at hand. Ignore the c++ stuff, but I find the reference very helpful for c programming.
C is a nice, lean language. Particularly for learning exercises, I don't think an IDE is all that necessary.
You can do plenty of learnin' with a nice text editor, gcc, and a copy of Kernighan & Ritchie's book.
Indeed, later on, you may find that that's all you'll ever need. But especially for getting started, the extra complexity of an IDE really isn't a benefit.
I would actually just use vim, Makefiles, gcc, etc. You'll learn a lot from that, too, and I really think it's a good idea to get some experience with tools like that. It meshes well with learning C. Makefiles can get pretty gnarly if your project is complicated, but for most of what you will be doing to "learn C" they shouldn't be more than a handful of lines.
Most (all, probably) of what you will be doing will be console apps; use this as an opportunity to get used to the Unix way of doing things. Learn some basic Unix commands, and use them to manage your projects.
It depends what you want to do and how much you want to spend. When I was starting out in C, I used an IDE called PellesC; it's free and I found it very easy to use and very useful.
However, one problem that I found with it was that some of the Windows GUI libraries aren't supported fully, so if you later on want to go down that route, then perhaps something like Visual Studio would be more appropriate - the express versions work just fine if you're not prepared to pay the large price tag for the pro version.
You don't need an IDE for everything, especially just learning. Just go with a basic text editor: Vim, Emacs, TextMate (if you're on a Mac), or whatever your personal preference is (I don't know what's popular in the Windows world, or if you're even using Windows). And pick up a copy of Kernighan and Ritchie's The C Programming Language -- it's indispensable for learning C.
I'm going to echo everybody here who says "don't use an IDE", and also explain why. C originated in an era where text editors were still cutting-edge technology, and as such, was designed from the get-go to be something that a programmer could write without needing extra tools to handle all the busywork.
C thus has zero boilerplate code, even though the language itself has grown quite a bit over a few years. Everything you do in a C program has a definite purpose, and if you want to learn the language, you should understand why you're typing things in. An IDE that handles things for you doesn't force you to deal with the details of the language yourself.
IDEs are tools for the working programmer, not the student programmer. Just as computer algebra systems (like Mathematica) are tools for mathematicians, not beginning Calculus students.
So, use a good text editor: vim
or emacs
. Although I am am vim
user, I'd recommend emacs
(if you're getting started with editors), just because it's more programmer-oriented.
Also, I suggest you first learn C on Linux, BSD, or some other flavor of Unix. That's where the language grew up, and understanding Unix will help you in turn understand C better.
You could use Eclipse, esp if you are familiar with it from Java, just so you have access to a compiler.
When I started I used vi and gcc but that was on Solaris.
It may help if we knew what OS you were using, or had access to, but, you don't need an IDE, but it can be helpful.
The hardest part, for me, about learning C was pointers, and I expect you will get questions on that, so you may want to study up on those.
Good luck.
I hear what everyone is saying about using notepad/vi and gcc.
However I use Borland's Turbo C++ (on Windows), it's also free and has a C compiler. I've no complaints about it.
i'd recommend getting K&R plus some most recent book because K&R can be tough at times, or at least it was for me, e.g for some reason i was never able to understand pointers by myself from the explanations in K&R and only got it right when i finally learned C at uni.
also, i believe somewhere on the web you can find guides for the K&R book, such as these Notes to Accompany The C Programming Language, by Kernighan and Ritchie and also i'd recommend that you always check the C-FAQ website once you start coding and all kinds of questions start to pop into your head (for example: "omg why can't i assign a new string to this char *c variable???"). it's all explained on there.
i think, more important than working or not working on an IDE is that whatever you do, at some point you should use a debugger to see how things really happen under the hood. especially when you start doing pointer arithmetic and stuff.
but if you want to deal with the whole compiling thing then just install gcc and the text editor of your choice.
The first step to learning C is to find a motive better than doing good at job interviews.
If you want an IDE, Bloodshed Dev-C++ is a good choice. It's free software, and the source code is available.
I personally like Vim, but there's somewhat of a learning curve before you can become comfortable with it.
I agree with the others that an IDE isn't the big thing. For sure start with the K&R C book as others have stated, but follow up with "Expert C Programming" by Peter Van Der Linden. It's a surprisingly easy and fun read, and will cover a heap of ambiguities and errors that occur while working with C... and even goes over a few classic interview questions at the end.