Iris Classon
Iris Classon - In Love with Code

Stupid Question 116: Do you need to know C to learn Objective C?

[To celebrate my first year of programming I will ask a ‘stupid’ questions daily on my blog for a year, to make sure I learn at least 365 new things during my second year as a developer]

Do you need to know C to learn Objective C?

As a continuation on the last question Stupid Question 115: What is the connection between C, C++, objective C and C#? I just had to ask, do you need to know C to learn Objective C? Where better to ask than on Twitter and Facebook :) Here are some of the responses!

In short most seemed to agree that while it would certainly help, it was not necessary to know C in order to learn Objective C.

in my eyes C is not necessary for learning ObjC, but it helps. Especially with CoreFoundation and other low-level APIs

not necessarily, since you have to learn C in either case, having that Obj-C is a superset of C. Interesting question though :)

since obj-c is a superset of C, then yes. you can’t know obj-c without knowing C. That said,you don’t need to know it all.

not required, but helps :)

I know a few iOS developers who skipped C, and a couple who went to Objective C without any prior programming experience.

No, but it helps! Certainly possible to pick up Obj-C without C knowledge though.

most Objective C books teach you what you need to know about C. I’m reading one now

Objective-C feels like a different language and from my point of view there is no reason to do that

Nope, but it certainly can help.

I guess it helps to understand the basic concepts.

I think it would help to know a bit, but not necessary. You are mostly using Cocoa & Cocoa Touch, not C
C isn’t a prerequisite, but you’d necessarily learn a bunch that is applicable to both. There’s a lot of overlap.

Obj-C is a superset of C, and OSX CoreFoundation APIs are only in C so yeah, you you’ll need to eventually.

I never learnt C before objective C think it helps but it’s not essential at all

In fact IME learning Objective-C is a nice way to learn about C - some things I missed learning C in college
it certainly wouldn’t detract from the learning experience, I wouldn’t say learning C was essential, but it wouldn’t be wasted

If you want to take your programming skills to the next level then learning C certainly helps but you don’t need it to learn OC

I’ve never done C but a lot of Objective-C. So it’s not required but might be helpful.

Certain system calls are more C-based than Obj-C. Plus you can use existing C code. Understanding pointers is important too.


Leave a comment below, or by email.
Paul McDonald
1/1/2013 10:06:36 AM
Great question and it seems there IS a benefit to learning C before Obj-C, but not an absolute benefit. This is something I've wondered so thanks for asking! UI Tip: It would greatly help the readers if you could use a different format for the quotes such as indenting the text, using a different font and size (and maybe a different color). 
Frans Bouma
1/1/2013 10:16:42 AM
Kerninghan & Ritchie's book is IMHO essential for every language. Teaches you what memory is, how to deal with it using pointers and that it's precious and you shouldn't waste it. Even with OO languages like Java or C#, knowing what a pointer is and how memory is allocated etc., helps with understanding what objects are and how they're passed around.

I can't imagine doing Obj-C development without knowing C: what a pointer is is IMHO essential for every C based language. K&R is IMHO a book every developer should have read. Especially chapters 5&6. 

Oh and 'the dragon book' ('Compilers' by Aho-Sethi-Ullman), but that's for another time ;) 
Iris Classon
1/1/2013 1:18:46 PM
Reply to: Frans Bouma
That book actually made the top ten books to read for programmers according to StackOverflow users :D 
Andy Dent
1/1/2013 1:30:49 PM
You need to know a slightly skewed set of C idioms. Definitely you need the basics of the C operators, operator precedence, conditionals etc. that are in C# and most other related languages. You may run into bit manipulation that I don't think is in C# (it's been a while since I did any). I think it's useful to know about things like:
- using extra braces to provide scope around variables so you don't declare them at the top of functions
- passing around function pointers, because blocks are explained by comparison to this technique
- typedefs to simplify types
- macros and the # and ## macro operators because you will run into them at some point
- malloc and free because I think you will run into them at some point and need to understand their semantics particularly failure to allocate and dealing with null returns 

Last modified on 2012-12-30

comments powered by Disqus