3

Do all functions (as opposed to class/instance methods) in Objective-C use C syntax for both declaration and calling?

2 Answers 2

6

well, it really is C. Objective-C is a superset of C, meaning that you can use any C construct you want and the compiler will handle it. Just declare C functions as you normally would, and call them as you normally would.

Sign up to request clarification or add additional context in comments.

2 Comments

So I declare it/call it like a C function, but it isn't merely a c function as I can still access Objective C objects/pass messages?
as long as your references are in scope, yes you can. e.g. if have have a global reference some objective-c object, you can send messages to it in your C function. YOu can't reference "self" though as you aren't in the implementation scope of an object.
3

Yes, they do. Objective-C is built on top of C, so the C syntax is valid.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.