Recommended for learning C - c

What could some of you recommend for using when learning C and programming with C?
I have thought of the following options. (On OSX)
Aquamacs
TextMate and the Terminal
XCode
I want to learn more than just the IDE so that I grasp the concept as I will be learning about compilers etc.
I tried Aquamacs when learning Erlang but it was more of a hassle than I enjoyed.
Is there a lot extra to learn when using an Emacs environment?
What is most beneficial for understanding how things work. ( C )
Are there any other tools or possible options worth looking into?
Thanks

If what you want to learn is C Programming Language in Mac OS X I would go with XCode. It has a very good GDB integration, and its learning curve is smoother that EMACS' or just writing your own Makefiles.

If you want to learn about C, in my opinion, you should use the most basic editor available, compile using the terminal with gcc. And that's it.
Once you'll understand the language, picking one IDE over an other will be a no brainer.
But no IDE will really teach you anything about C.

There's also BBEdit on OSX. (I've used it briefly in the OS8 days.) As far as learning C goes, there are a number of books that you can try. I'd pop down to whatever chain bookstore is closest and browse the Programming section.
I'd also invest in a good algorithm book.

If you want to use Emacs as an IDE, you will need to write Makefile in order to be able to compile from within Emacs. Writing Makefile could help you understand the compiler options, object code, linking and such.
So to use Emacs as IDE for learning C, you should be using C-mode, know about M-x compile and using gdb under Emacs(M-x gdb). To look up man pages for library functions, M-x man and supply it (3 printf, for example to read the man page of C I/O function printf) the section number and function name.
I am not sure if using Emacs+Makefile this way is most beneficial in helping you teach how to compile, link, build etc, but it sure does help in learning those ideas.

If you're not comfortable using a more advanced editor like vim or emacs, then I would suggest using TextMate or something similar. This would let you concentrate on the code you're writing rather than struggling to learn how to use the editor.
Using a full blown IDE like XCode will also allow you to pretty much ignore the build system while you're still learning the language itself. Once you get comfortable with C, learning things like make or cmake would be less overwhelming.
Then after that, maybe you can go back to check out vim or emacs and see what a more complex editor can do for you, if anything.

Related

Starting with C using eclipse

I wanted to start programming with C, just because it is still important, and you need it for many study paths.
So i used eclipse before for programming java (just basics), and saw that you can use it for c/c++ too by installing other features. But I don't understand how to get it working, i tried several guides, but they were all outdated. I don't know how to link a compiler to eclipse, or whatelse I need.
ps: Sorry if my english may sound a little odd, I'm from germany.
please follow this link you can download
https://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/lunar

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.

how much c programming should I know before indulging into sdl programming

I have programmed in c and I know about data structures and algorithms, but It has been a while since I programmed in c. I forgot things like how function pointers and some advanced stuff in c work. I want to try graphics programming using sdl. my question is how much of c should I know (for example should I know function pointers) before getting into this. Or in other words will I be stuck if I dont remember a lot?
I think basic knowledge of C should be enough. Look for some SDL tutorials and follow them closely, you will refresh your knowledge of C and at the same time learn how to use SDL. It might go a little slower at first, but you will get into it.
Try for example: SDL Tutorials
Or: GPWiki SDL tutorials
Or: Lazy foo
The first one offers also C tuts. As for functions pointers, you might need them later, when you get to the more advanced stuff. With the basics, you will see everything in tutorial source code and believe me it is easy to understand.
If you like books, try: Focus on SDL
Dont know if there are better ones.
I see PeterK posted lots of good stuff, but I figured I'd throw my two cents in as well. When I started using SDL (3-4 months ago), I had a little experience in Java and no experience in c/c++. Using LazyFoo's tutorials (http://lazyfoo.net/), I was able to get up to speed very easily. I would recommend it to anyone who wants to learn SDL.

Any Online compiler you know for C or other languages? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Any online C compiler that you know which can do the following:
Compile and execute the C programs online
File handling
System functions like exec(), system(), fork()
Or any compiler which does not need installation procedure (I mean that you can just copy paste a folder to run the compiler easily)
Note:Please do not propose Turbo C.I know some online compilers at codepad.org (gcc).
I was using codeide.com but its out of service now I think.
And as asked above online compiler will be a best advice that you can give for me.
My environment is Windows ... Thanks in advance.
Any advices on other Language compilers are also invited
Just install something like tcc. It's seriously not worth messing around with an online compiling site if you're going to be compiling files on any sort of regular basis.
Comeau has an online C/C++ compiler, but it's mainly to evaluate their compiler.
or cygwin
I'd rather recommend to install cygwin, you'll get an unix-like environment, with gcc. Then setting up a Makefile - or even just a shell script - to be able to compile is not a big deal.
You asked for other languages: Here's one for Lisp (not a compiler, but an interpreter)
Online Lisp interpreter in Flash
rextester
Maybe my answer is a bit late, but we have created an online compiler and IDE where you can run and create your files using just a browser.
At the moment we support a few languages (C, C++, ObjC, Java, Pascal, Fortran) and a simple file system, but we will enable many more features for better coding and debugging during the near future.
All the features offered at the moment are completely free and there is no registration needed (you can register though in order to keep your files online).
You can try our service here: www.sourcelair.com
DJGPP Public Access Cross-Compiler (C/C++, DOS32, based on GCC)
yet another online compiler:
http://cmpe150-1.cmpe.boun.edu.tr
It supports sytax highlight, indentation etc. I wrote it as a part of my MS thesis
PS: did not test fork command
We have another compiler for C and C++ here: http://www.codepad.org/
I have nothing for C. For other languages, this is a ruby interpreter. But honestly the best online development environment is the browser itself. Javascript is an advanced language. Combined with technologies like CSS and DHTML and frameworks like jQuery or Prototype you can build graphics applications. It is not hard to find debuggers (like Firebug) also.
Of course you can't interact with the file system. To overcome this you could write a plug-in for a browser (notably Firefox). There are many resources available for this and although it is not as straight forward as pure javascript, it is easier than most people believe.
For Python and Sage, try out http://live.codenode.org. It is also open source under the BSD license, so you can be download and run it from your own computer, more info is here: http://codenode.org
just a sudgestion.
I do not know why you do not want simply to install a compiler. However did you considered the possibility of using a portable one?
http://en.wikipedia.org/wiki/Portable_C_Compiler
best,
Ste
One of the better lists for C++ is isocpp Getting Started page. Unfortunately Cameau's seems to be disabled for now. LiveWorkspace has been in maintenance mode for a while and it is not clear when it is coming back, which is unfortunate since it has a simple interface and when it was working allowed you to switch between gcc, clang and intel very easily.
Of the ones that are left Coliru is the most powerful, you have a full command line available and you can save files and therefore uses multiple files in your project.
The isocpp list somehow is missing codepad which although rather primitive along with Coliru allows you to use boost.
Coliru, ideone and codepad all support many other languages as well. The list of languages supported by ideone and codepad is pretty large and is obvious on the main pages with Coliru you don't have a list but besides C and C++ it also supports python, perl and ruby.

Getting Started with C and Objective-C

I am eventually wanting to program in Objective-C to write programs for OS X and possibly the iPhone. I do not have any direct experience with C and I come from a web programming background. I am much more familiar with java syntax than C and Objective C.
I am just looking for suggestions on how to get started. It looks like I need to just start with C (I do not yet have a Mac computer powerful enough for programming, so it would be nice to start with C on the Windows platform anyway (information about programming environments would be helpful too, I am used to eclipse)). I am just looking for book recommendations, online tutorials or any other pointers to keep in mind. Keep in mind though that my end goal is to work with Objective-C, so is there anything I need to keep in mind when learning C, anything to watch out for, etc. Thanks for any input.
Update: The reason I am thinking I need to learn C first is that most of the tutorials that I have come across so far for Objective-C assume you already understand C syntax, which I do not fully. Are there better tutorials out there for me?
I don't entirely agree with unwind who says "C and Objective-C are different languages". Objective-C is a strict superset of C.
Of course he knows that - his point was that you don't need to completely master C before progressing onto Objective-C. I'll second that (and hopefully have clarified it).
But I do think it's worth getting some basics with C first, as most introductory texts on Objective-C will assume a basic knowledge.
I don't have any recommendations on that myself, but probably most internet based tutorials will be sufficient for that purpose (remember, you're not trying to master it at this stage). If you want to take it seriously, then "The C Programming Language" by K&R is the classic text.
When you you can do some basic hello world programs in C, and understand the type system, pointers and stuff - then pick up a copy of "Cocoa Programming for Mac OS X", by Aaron Hillegass. This is a book about Cocoa that covers Objective-C along the way, but it one of the best presented coverages of the language. It will assume you are coding on a Mac (it's in the context of Cocoa after all). You may be able to follow the pure language stuff using GCC on Windows, but I wouldn't recommend it.
If you're going to be working on a Mac eventually, then best to do it at this stage, IMHO. You say you don't have a Mac "powerful enough for programming", but anything that can run OS X would be fine to get your started.
If you know java, obj-c will be easy for you (java was influenced a lot by obj-c.) Apple has great documentation, you can start here. I don't think you need to learn C before learning obj-c (sorry Joel).
You can use obj-c on windows if you get gcc. Also check out cocotron:
The Cocotron is an open source project
which aims to implement a
cross-platform Objective-C API similar
to that described by Apple Inc.'s
Cocoa documentation. This includes the
AppKit, Foundation, Objective-C
runtime and support APIs such as
CoreGraphics and CoreFoundation.
With all the buzz about iPhone development, there are now dozens of obj-c books. Not sure how good they are, but a classic that I would suggest is Cocoa Programming from Mac OSX by Aaron Hillegass.
Programming in Objective-C by Stephen Kochan is what you want. It assumes no programming experience but doesn't hold you back if you do and introduces the whole thing, C with the Objective-C superset, as a complete package. I read the first half of Kochan (the second half gets into Cocoa) and now I'm working on Cocoa Programming for Mac OS X (3rd Edition) by Aaron Hillegass and reading Kochan was a massive help. Those two are a "one-two punch" that will get you going in no time.
Have a C and Objective-C reference handy as Apple's docs of C in XCode pretty much sucks from what I've seen so far. K&R's C text is like the Encyclopedia Brittanica of C and, just like a set of encyclopedias, isn't for everyone. I've just been Googling for references and generally find what I need on the web since C is so ubiquitous.
You'll burn through a couple of books before you find the set that best fits you, but you simply can't go wrong with Kochan and Hillegass for Objective-C and Cocoa. By the time you finiah the first couple chapters of Hillegass, you'll want to (and be able to) start writing some stuff on your own.
There is a recent blog-entry at Tuaw:
http://www.tuaw.com/2009/01/15/starting-out-with-objective-c/
4 guides about getting started with Objective-C, which helped me quite a lot when I started developing in Xcode. You should take a look at this:
http://cocoadevcentral.com/
http://developer.apple.com/iphone/index.action
http://developer.apple.com/iphone/library/referencelibrary/GettingStarted/Learning_Objective-C_A_Primer/
http://developer.apple.com/iphone/library/documentation/userexperience/conceptual/mobilehig/Introduction/Introduction.html#//apple_ref/doc/uid/TP40006556-CH1-SW1
I'd say that it's better to learn C first. be sure to approach it like what it is: a structured machine language.
when you feel comfortable on it (no need to really master it), go on to Objective C, where you'll rediscover several things familiar from Java, but knowing the C infrastructure will make more apparent when they're similar but not equivalent.
it's very important not to learn a language using what you already know as a 'metaphor' for the new. always try to pretend you didn't know anything before.
I don't know what you mean by a Mac powerful enough to do programming on (any Mac should do), but get yourself something at least marginally useful as a development system soon. (You may well have the development system on one of the CDs that came with your Mac, or alternatively you can download it from Apple.)
The sooner you get Xcode working, the sooner you'll be comfortable with it.
I have recently started to learn programming for the Iphone and tried many differenet books until i found these helped me the most (I would also strongly recomenned getting a mac since the Xcode is the way to go when coding for Iphone):
Apress: Learn C on the Mac (To
get the initial C going)
Apress: Learn Objective-C on the Mac
(Learn Objective-C based on your
understanding of C)
Apress: Learn Cocoa for the mac
(learn apples way of building
applications, greatly helps when
going over to Iphone however you can
go straight to the iphone if you
like)
Apress: Beginning Iphone
development... (The final book,
and essential tool)
To note all these books have the same author and thus the traceability is great! The books have crossreferences between each other that really helps.
Agreeing with others, I found Cocoa Programming for Mac OSX - Hillegass
a great intro to Objective-C, the Cocoa framework and whole Apple way of doing things.
You can run Objective-C on any Linux or Windows box too although of course you won't have access to all the Apple libraries eg. NS (afaik). These frameworks are really the whole point of Objective-C, and the real reason it still exists given C++ and C# came later and are more or less languages designed around themselves (as opposed to Objective-C which is a strict superset of C).
Apart from pointers, I think you can get by without learning all the intricacies and close-to-the-metal aspects of C, although any and all C you can digest always helps.

Resources