AppleInsider › Forums › Software › Mac OS X › Learn C using Mac OS X
New Posts  All Forums:Forum Nav:

Learn C using Mac OS X

post #1 of 8
Thread Starter 
Sorry if this is a duplicate. I tried searching without finding anything relevant.

I'd like to learn C using Mac OS X. Eventually I want to work my way up to using Cocoa for some specific apps I'd like to develop.

I've found pretty good resources for learning Cocoa but they presume you know C. The resources I've found so far are windows centric. Is there a tutorial based on using OS X?

I have a lot of experience with writing software for years in several different languages and have used Applescript quite a bit and have some experience with Applescript Studio so I'm not starting from scratch.

Thanks for any suggestions you can supply.
Unofficial AppleScript Studio Lobbyist
Reply
Unofficial AppleScript Studio Lobbyist
Reply
post #2 of 8
You can create a standard tool in XCode using File > New Project > Command line tool > standard tool. Then it sets you up with a main.c file and you can start building functions and code around it.

The best reference for C is the Kernighan and Ritchie book (save the PDF):

http://www.thungsong.ac.th/teacher/c...guageAnsiC.pdf

They developed the language itself so it's kind of the definitive reference for C.

Here is a short tutorial (ignore the disclaimer, it's still a decent overview of C):

http://www.lysator.liu.se/c/bwk-tutor.html

Cocoa is an object-oriented language but C is procedural so you won't deal with classes and things in C. It won't fully prepare you for Objective-C but IMO it's still one of the best languages to learn.

To extend to classes, you can imagine that instead of functions lying about on their own, they are contained in objects. You then instance the objects and call the functions via the instance.

The syntax of Objective-C is a bit different too so you should probably start looking at it right away so you can see the equivalent way of writing things.
post #3 of 8
I'm no computer scientist but the good think about learning C is that you have to learn your pointers and data types and what not to be able to use it. It's a good exercise for the reader.
post #4 of 8
you can use nearly any Unix/Linux C tutorial or examples as well. Because Xcode is simply a wrapper for gcc (and llvm-gcc), when you install the developer tools you also get the full set of GNU development tools (and now LLVM as well).

If you haven't already, sign up for a free ADC account at developer.apple.com, and download the latest development tools (3.1.1).
post #5 of 8
Thread Starter 
Thanks one and all.
Unofficial AppleScript Studio Lobbyist
Reply
Unofficial AppleScript Studio Lobbyist
Reply
post #6 of 8
Quote:
Originally Posted by neutrino23 View Post

Sorry if this is a duplicate. I tried searching without finding anything relevant.

I'd like to learn C using Mac OS X. Eventually I want to work my way up to using Cocoa for some specific apps I'd like to develop.

I've found pretty good resources for learning Cocoa but they presume you know C. The resources I've found so far are windows centric. Is there a tutorial based on using OS X?

I have a lot of experience with writing software for years in several different languages and have used Applescript quite a bit and have some experience with Applescript Studio so I'm not starting from scratch.

Thanks for any suggestions you can supply.

The language you need for Mac Programming is Objective C. It is based on C - but extended to make use of object-oriented programming.

There are books on C. And there are books on Objective C. But Mac programming also requires that you understand the Model / View / Controller idiom.

For most folks, the best book to start you along the path is...
http://www.amazon.com/Cocoa-Programm.../dp/0321503619

C.
post #7 of 8
Thread Starter 
Some books have just been published that look to be just what I needed.

They are available as pdf docs at apress.com. I bought the C and Objective C books. I already have a good book on cocoa also by Aaron Hillegass.

Title: Learn Objective-C on the Mac
Authors: Mark Dalrymple and Scott Knaster
ISBN-13: 978-1-4302-1815-9 | ISBN-10: 1-4302-1815-0
Pages: 360 | eBook Price: $27.99 USD | Printed Book Price: $39.99 USD

Title: Beginning iPhone Development: Exploring the iPhone SDK
Authors: Dave Mark and Jeff LaMarche
ISBN-13: 978-1-4302-1626-1 | ISBN-10: 1-4302-1626-3
Pages: 536 | eBook Price: $27.99 USD | Printed Book Price: $39.99 USD

Title: Learn C on the Mac
Author: Dave Mark
ISBN-13: 978-1-4302-1809-8 | ISBN-10: 1-4302-1809-6
Pages: 376 | eBook Price: $27.99 USD | Printed Book Price: $39.99 USD


Apress Inc., part of Springer Science+Business Media, is a technical publisher devoted to meeting the needs of IT professionals, software developers, and programmers, with more than 700 books in print and a continually expanding portfolio of publications. Apress provides high-quality, no-fluff content in print and electronic formats that help serious technology professionals build a comprehensive pathway to career success.
Unofficial AppleScript Studio Lobbyist
Reply
Unofficial AppleScript Studio Lobbyist
Reply
post #8 of 8
I have been teaching myself C on the Mac using these books... I thought that it would be nice to do some development on a portable device so I could show friends what I am doing without having to power up a lap top.

I have worked in the games industry for about 15 years and have been surrounded by a wide range of high and low level languages, so I have picked up quite a bit by osmosis before this... but I have to say, The Dave Mark book on Learning C on the Mac is one of the hugest pains I have ever had to endure.

I don't know if the book is poorly layed out, if old school C is just that much of a pain, or if I am just that dense... probably some confluence of all three, but this feels like staring at mud to understand water. I am at the next to last chapter on data structures and I just feel like I cover the same ground again and again with no better understanding of what I read.

I am only sticking with it because I know that I will need the info before I go to Objective-C.

It feels like the kind of book that moves units because there isn't much competition.

I am going to try comparing notes with a web site that I just found. www.masters-of-the-void.com

Maybe a diffent perspective might help.

Good Luck.
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Mac OS X
AppleInsider › Forums › Software › Mac OS X › Learn C using Mac OS X