C or C++

Zimbop

Registered
I've been working in PHP for a couple of years now, but would like to take a step into programming Mac (OSX) applications.

I don't know any C or C++ whatsoever, and presume that this should be my first step, but which should I study, C or C++ ?

I'd also be grateful of any recommendations of books on C or C++ for complete novices.

Thanks

Zim
 
Originally posted by Zimbop

I don't know any C or C++ whatsoever, and presume that this should be my first step, but which should I study, C or C++ ?

Just....don't ask that. You'll start a religious war. Flip a coin or something. Or just learn C++, if you don't plan to use plain C, ever.
 
C++ seems to be the "standard" nowadays. Almost everything I've seen has been in C++.
 
Not to beat this topic to death, but if you want to learn C++ you'll certainly need to understand C first, and there are many instances where you'll use vanilla C functions in conjunction with C++, so again, it's a must to know.

Since you already know PHP you're halfway there. The most striking thing about C in contrast to PHP is the way you have to deal with data types. In PHP all your variables are scalar, freely converted between strings and numbers. In C you have to be very cautious about how you deal with your variables, especially arrays and strings (arrays of characters). This is because C doesn't do anything in itself to prevent you reading or writing beyond the end of your buffers.

Get the original Kernighan & Ritchie book on C and tool around with console applications. Once you feel comfortable with the behavior of C variables then you should move on to C++ - and heck, learn Objective-C while you're at it.
 
Right on!

The original Kernighan & Ritchie book on C is a great tool. It can be a bit dry though. After going through "C for Dummies" volumes 1 & 2, it all made much more sense. My background is in PHP as well and making the jump to C (pointers, yuk!) would have been impossible using only the K&R. The dummies book tied it all together for me.

Good luck!

Martin
 
And why should'nt you start with Objective-C and Cocoa ? O'Reilly's "Learn Cocoa" has a whole chapter about Objective-C before starting with Cocoa classes, and this would allow you to start directly with GUI apps development (isn't it nice ? :) ).
 
If you want to learn how to build back end moduels for darwin or any brand of unix type OS study C .

If you want to work on front end GUI functions like games or stuff to work in the Aqua environment study C++ .

Unix was built with C , when studying C you will recognise the standard functions common with basic unix commands .
 
Every Obj-C book I have read so far assumes a working knoledge of C, so you should probably learn C first if you want to go down that road. C as a language is pretty easy, the ANSI C library though will take you a while to learn.
 
Back
Top