Do I need anything else to learn C?

Discussion in 'Mac Programming' started by bftiedt, Jul 5, 2010.

  1. bftiedt macrumors member

    Joined:
    Feb 12, 2008
    #1
    Hey guys I have been browsing around the web for a while looking for information on programming. I would like to learn how to program for MAC. From what I have found it seems like most people are saying "C" is a good language to have as a base. So I picked up a copy of "The C programing language. I started to read it today but before I got to far into it i wanted so ask some actual programmers.. can I really learn the basics of C from just this one book alone? Are there other books I should also be reading to help with the understanding of this book? I have no programming background. What are you guys thoughts should I just dive in and read this book or are there others you suggest I read along side the one I already have. I just want to do this right if im going to do it. Any help would be great guys . Thanks
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    You might be able to. You might not. Quite a lot of people just don't "click" with programming and nothing will enable them to learn to program. You won't know unless you try.
     
  3. bftiedt thread starter macrumors member

    Joined:
    Feb 12, 2008
    #3
    from what i have been able to find online it seems like there is a little bit of math involved in learning to program. Is this true and if so are there any books or anything like that that may help me in that area if need be?
     
  4. neutrino23 macrumors 68000

    Joined:
    Feb 14, 2003
    Location:
    SF Bay area
    #4
    C is the basis but Apple uses Objective C used inside Cocoa.

    Go to Apress.com and you will find books about teaching yourself all three topics. You can get these books as PDFs so you can have them handy anytime.

    Others more knowledgeable than I will chime in. I suggest the following.

    Learn C on the Mac by Dave Mark
    Learn Objective C on the Mac by Mark Dalrymple and Scott Knaster
    Cocoa Programming for Mac OS X by Hillegass (maybe not at Apress)

    By the time you get through the first two books you will probably find lots of other resources on your own. Apple has a number of free PDFs as well.
     
  5. mdatwood macrumors 6502a

    Joined:
    Mar 14, 2010
    Location:
    Denver, CO
    #5
    You could learn C from that book. It is quite terse, and some people need more explanation than it provides on a given topic. If you're brand new to programming then using C can just as easily teach you about functions, parameters, loops, and conditionals as any other language so it's a fine place to start.
     
  6. GorillaPaws macrumors 6502a

    GorillaPaws

    Joined:
    Oct 26, 2003
    Location:
    Richmond, VA
    #6
    I really liked this free online tutorial by Uli Kusterer. It's certainly not a complete substitute for a good book, but his explanations (and animations) of some of the more tricky concepts (e.g. stack vs. heap memory and pointers) are really a terrific resource if you're just getting started.

    I highly recommend Stephen Kochan's "Programming in Objective-C 2.0", once you decide to move on to Objective-C" He has also written a book on the C language which is highly regarded.
     
  7. bftiedt thread starter macrumors member

    Joined:
    Feb 12, 2008
    #7
    thanks a lot guys for your help so far. I have been able to find a guy on youtube that has a lot of videos on using xcode. He also goes over functions and variables , some of the stuff i wasnt really getting in the book I was reading. I think im gonna watch all of his videos explaining the basics and then continue reading. I think its going to help a lot seeing and hearing someone explain it instead of just reading it . I have also thought about maybe taking a computer science 101 class at a local community college. Do you guys think it would be worth taking or could I learn what I would get out of that class from books and internet?
     
  8. Sander macrumors 6502

    Joined:
    Apr 24, 2008
    #8
    I'm sorry, but "it depends". No, really.

    Some people learn best by watching someone else do things, some by having discussions, some by looking at other people's code and figuring out what it does, some by sitting quietly in a corner with a reference book.

    The K&R book is aimed at "systems programming" (one could argue that's what the whole language C is aimed at) so their examples are in that category too ("how does malloc() work?"). If you're interested in that stuff, it can be a real eye-opener. If you expect to have implemented a networked multiplayer 3D shoot-em-up after two chapters, you'll be disappointed.

    Good luck!
     
  9. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #9
    You can probably learn C from reading K&R, it's not a really large language, IMO you learn the most by doing a lot of programming. Perhaps you could add a reference type book later, I got the C in nutshell book from O'reilly that also cover c99. If you use the terminal in mac os be aware of the man pages! They cover all of the standard C functions and is a really great resource if you work this way, for quick lookups IMO. I also like Uli Kusterer's online tutorial, nice.

    Edit: I also agree about the comment that K&R is terse, there are other books that offer more hand holding.
     
  10. BernardSG macrumors newbie

    Joined:
    Mar 2, 2010
    #10
    C is not a necessary step to start programming for the Mac, even though at some point, you will probably need it if you have to deal with heavy programming problems.
    Actually, I'm of the belief that C is not the best choice to start with, if you have zero or near to zero programming experience, unless you have a very sharp "math-mind".
    I suggest you join the Apple Development Center for free, get xCode installed on your Mac (you can download it from the DevCenter, but you probably have an older version in your Mac OS X installation disk).
    Apple provides a lot of free documentation about the Mac programming environment. I find it not to be very practical, in terms of programming per se, but it provides a lot of insight about how the Mac and its applications work and about the various development tools at your disposal.
    To actually start programming, you will focus on Cocoa/Objective C. There are two very popular books you will want to read, that were already cited before:
    - Programming in Objective-C 2.0 by Stephen Kochan, which targets people who are complete noobs in programming,
    - Cocoa Programming for Mac OS X by Aaaron Hilleglass, more complete but needs a minimal C background and/or some programming experience.

    Programming and developing skills are acquired 80% by practice, and 20% with theory. That's why my opinion is really to start with Cocoa so you will code little applications that actually do something on your Mac with the interface you are used to, then gradually expand your knowledge by including elements of other languages and tools.
     
  11. cromwell64 macrumors regular

    Joined:
    Jun 30, 2008
    #11
    If you want to learn to program for the Mac platform, then I agree with what others have said here.

    The best place to start is with Programming in Objective-C 2.0, and then follow that with Cocoa Programming for Mac OS X. Just make sure you get the most recent editions of each and you are good to go.
     
  12. mrbash macrumors 6502

    Joined:
    Aug 10, 2008
    #12
    In terms of the fundamentals, K&R's book is the bible and the right place to start. I still use those books as a reference.

    If you have gone through either of those books, front to back, and done the exercises in them, the only thing you would probably need to know is a 1st year Data Structures course.

    I used Tanenbaum's "Data Structures using C". It was simple and had a good introduction to algorithms along the way.

    After that you can pretty much say that you know C.
     
  13. milbournosphere macrumors 6502a

    milbournosphere

    Joined:
    Mar 3, 2009
    Location:
    San Diego, CA
    #13
    Bingo!

    You are on the right track with this approach. If you're really serious about learning, take a C course at your local community college to see if it's up your alley. If you find even a half decent professor, you will learn far more about the language and good programming practice than you ever would just reading from a book. Doing labs and getting feedback from experienced persons is paramount to the learning process, IMO. After all, there is much more to computer programming than just getting a program "good enough" to do what you want it to.

    That said, C is becoming harder to find in community college courses (I just looked at the CC i went transferred from, and all the basic courses are now taught in Java); however, if you can find one, I would jump all over it.
     
  14. Rodimus Prime macrumors G4

    Rodimus Prime

    Joined:
    Oct 9, 2006
    #14
    bit late to the thread but the hardest part I believe to learn about programing is learning to think like a computer. After you understand the logic and the basic the rest of it is mostly learning syntax and more advanced stuff of different languages but the logic foundation is there.

    The thinking like a computer part it is either you can do it or you can't there is not much of an in between.
     
  15. ulbador macrumors 68000

    ulbador

    Joined:
    Feb 11, 2010
    #15
    Personally, I find classes and books absolutely useless for learning a new language. On the other hand, with a few examples online and the API documentation, I can be fairly proficient in almost any language pretty quickly. Of course, that is entirely for me and my learning/comprehension style.
     
  16. Mac_Max macrumors 6502

    Joined:
    Mar 8, 2004
    #16
    http://www.cprogramming.com/tutorial.html

    There's a pretty good C tutorial on that site.

    That said, I would suggest starting with C++ instead for a couple reasons.

    - C++ is built on top of C, i.e. a bug free C program will compile in C++ no problem.

    - The basics of C++ happen to be the basics of C, and C++ can use the C Standard Library.

    - C++ is an object oriented language like Java, Objective C, C#, etc. At the same time you can still program in the same procedural methodology that C is generally programed with (this is true of the other languages mentioned as well). At the same time, your new OOP skills will transfer right into Java, OC, C#, VB.net, etc.

    Those three reasons lead me to recommend it over C. That said, it's not without it's own frustrations and there probably isn't any one task you can solve with C++ that C is unable to do. C++ is designed to make complex problems in C much more manageable through better use of code and doing better compile time checking.

    If you wan't to take a look at C++, try Bruce Eckel's Thinking in C++ series. He has the current edition available as a free download and the print versions aren't particularly expensive. If you do learn C first, try his First Edition - which happens to be geared to C programers transitioning to C++. I purchased a copy off Amazon for about $5 shipped. The Second Edition is a little more wordy and is designed for new programers as well as seasoned programers with experience in another language (or a basic knowledge of C++). The second edition comes in two volumes and runs for about $30 each or, as I mentioned, is free care of his website:

    http://www.mindviewinc.com/Books/
     
  17. zippyfly macrumors regular

    Joined:
    Mar 22, 2008
    #17
    That book you have is called "The K&R" and while I believe every programmer should have a copy of that book, I myself am not actually too in love with it. I never actually learned C from that book and use it OCCASIONALLY as a kind of reference book. In fact, I have found MUCH better information from different other kinds of books, which leads to my suggestion for you to go to the library and try to read many other kinds of introductory C books.

    Buying the K&R is a good move, and later you can decide which ones you want to own.

    I say go to the library because C is not a new language so you can get a ton of info even from old books.

    For modern stuff, you WILL need to get a more modern book on Objective-C 2.0 but I suggest having a strong C background first.

    Objective-C can be quite confusing (at least as I've found) even with a C background and even with a Java background, for that matter!

    But don't be discouraged. I know some people here say certain folks just "get it" and some aren't cut out to be programmers. I say hogwash.

    Just because you don't immediately "get it" does not mean you don't. I could mean the writer or teacher didn't know how to explain it in a way that is most conducive to your own brain function. (Everyone thinks in a different way; even our specific brain regions are as unique as fingerprints despite what you might have been told by older books).
     
  18. zippyfly macrumors regular

    Joined:
    Mar 22, 2008
    #18
    Before I forget... save your money and time from those classes, and take the FREE ones from Stanford... on iTunes University (iTunes U).

    They teach mostly Java and not C. But will get you grounded. Java shares a lot of syntax with C (similarities between the languages).

    Enjoy!
     
  19. iEdd macrumors 68000

    iEdd

    Joined:
    Aug 8, 2005
    Location:
    Australia
    #19
    This is not quite true. C++ is not a superset of C. Not everything is syntax-for-syntax compatible. (Conversely, Objective-C is a superset of C and any C code will compile in Objective C.)

    I took the advice of "you don't need to learn C first" the first time I tried to learn Java, and gave up. Same thing happened the first time I tried to learn objective C.

    Of course, the approach anyone recommends is probably just what worked for them, but in my opinion, it's best to work in stages from easiest to hardest. This is what is working for me so far:

    1. Learned procedural programming in Python.
    2. Learned object-oriented programming (OOP) in Python
    3. Learned C, which uses the same concepts I learned in #1, but additionally had to use stronger syntax with braces and variable declarations, as well as pointers.
    4. Learned Java by expanding on syntax from #3 with concepts I learned from #2.
    5/6. Learning Objective-C and Cocoa in my own time and going to do a C++ course at uni soon.

    IMO 1-3 is the best way to learn programming in mainstream languages without biting off more than you can chew. #4 could be Java, Objective C, C++ or C# and the learning curve would likely be about the same.
     
  20. zippyfly macrumors regular

    Joined:
    Mar 22, 2008
    #20
    I agree. I find that jumping into Objective-C without a stronger C background is what screwed me up initially. I had no problem learning Java head on though. Prior to Java I only knew BASIC, Pascal, and some Assembler (and recall trying to learn some rudimentary C many eons ago).

    I learned PHP after Java. Not sure if you can call PHP a language (OK I jest, it's a proper language).

    I guess saying I programmed in Pascal sort of dates me. (What's Pascal? the kids ask).

    ;)
     
  21. 22Hertz macrumors regular

    Joined:
    Oct 20, 2007
    #21
    Im learning programming also.

    What Ive decided to do is first learn Java.
    Reason is Java is similar to C and I found a good book I like that teaches Java. Java is open source and plenty of examples are floating around on the net.
    Spend time looking at the API...here you will learn a lot.

    This is the book Im using:
    http://www.amazon.com/Murachs-Java-...21/ref=sr_1_15?ie=UTF8&qid=1286130965&sr=8-15

    My advice is download Eclipse, get this book, learn the concepts of programming using Java. Follow along the examples in this book and make sure you understand why you are doing what you did.
    Once you know the concepts and tools available half the battle is won.
    There is no substitute for hands on...have fun!


    I also have the iTunes U courses downloaded, but haven't watched them yet.
     
  22. mac2x macrumors 65816

    Joined:
    Sep 19, 2009
    #22
    I've been enjoying MIT 6.00 from iTunes U, which is geared towards learning to think right rather than just learning a language (I'm in a real class for that).

    The best part is that it is a paperless course, and all course materials can be downloaded.
     
  23. albestar macrumors newbie

    albestar

    Joined:
    Oct 17, 2007
    Location:
    Eldorado
    #23
    Well, everyone has a different point of view on the best “first contact”. Imho the good news is that targeting an Apple platform grants you a very gentle start because documentation is very well written and gets straight to the point. Apple dev portal has lots of useful docs and nice projects you can run, examine and modify in Xcode.

    But I digress, back to the point!
    I think you need both procedural concepts (they form the basics and will be required if later on you’ll want to incorporate in your programs nice things like opengl) and Object Oriented concepts right from the start. Kochan’s book Programming in Obj-C is invaluable in this first step, it will teach the best of both worlds in one run and is very accurate an readable. Learning Obj-C without a previous C knowledge means you are actually learning both, it’s a superset of C so you can mix and match code without modifying a single line (that’s why C++ or C# would be a bit more complicated in this case). All of C fundamentals are in the book so you are learning the real deal but I suggest to back it up with the other Kochan book (Programming in C) to better grasp concepts like pointers and structures. Btw I think K&R is a really hardcore start, it’s not written with a modern software developer approach, better use it as a sort of historical reference. And yes, I think any language in the C family is the best way to learn programming!
    After this step you can move onto learning programming patterns (and of course writing your own first programs!) through the use of an API. Language provides the logic but it’s nothing without a good library to do the dirty stuff, assembling the UI, archiving to disk, drawing graphics and so on. Cocoa has lots of modern programming patterns and nice visuals and for that there are many great tutorials.
     

Share This Page