Darren Findlay
Darren Findlay

Reputation: 2563

Mixing C and objective-C

I've been using objective C for a while now, and I've started learning some of the lower level iPhone API's such as core audio. Most of these API's are in C which is confusing me a bit, I'm not sure where to put a lot of code and I don't know the rules, etc. Does anyone know where a good place to start learning this is?

Thanks, Darren.

Upvotes: 5

Views: 784

Answers (3)

kubi
kubi

Reputation: 49354

Does anyone know where a good place to start learning this is?

  1. Buy and read "The C Programming Language". It's not very long and surprisingly enjoyable.
  2. Read and understand Apple's C-based example code.
  3. Browse the header files for Apple's classes. This is a great way to learn how apple sets up enums and string constants, etc.

Doing these three things won't make you an expert in C, but it'll give you 90% of what you need to be able to confidently get things done with Apple's low level frameworks.

Upvotes: 2

FreeAsInBeer
FreeAsInBeer

Reputation: 12979

Objective-C is a superset of classic C, which means you have access to everything C as well as everything implemented in Objective-C. You can write in both if you wish.

Upvotes: 2

Dad
Dad

Reputation: 6468

You can write C inline inside any Objective C method. You can also define functions in a .c file and their prototypes in a .h file which you can then include into any ObjectiveC .m file and call from within Objective C code.

Upvotes: 6

Related Questions