34,333
edits
Changes
→How to Declare an Objective-C Function
}
</pre>
== The ''main()'' Function ==
If you have been reading this book sequentially, you will have noticed that many of the examples in previous chapters have contained a function called ''main''. THis is a special function name that tells the Objective-C compiler where to start program execution. If you do not have a main function your code will fail during the link phase of the build process. The syntax for a main function is as follows:
<pre>
int main (int argc, const char * argv[])
{
/ Code here
}
</pre>
The ''argc'' argument contains a count of the number of arguments that were found on the command line when the program was executed, and ''argv'' is a pointer to an array containing those arguments.
== Calling an Objective-C Function ==