Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

3.11. Header Files

As you need to declare functions, structs, and globals before you can use them, it helps to have all of these things in one place. This is what header files do. Header files are very useful in large projects, because they help you understand what the code does without having to look through every single line—sort of a “table of contents” for one part of a program. They usually have a .h file extension.

Use Xcode to create a new file named MathFunctions.c. This time, though, leave the “Also create MathFunctions.h” checkbox activated so that Xcode creates the MathFunctions.h header file, too. We’ll use this in an example program shortly. Save the files in ~/CocoaBook/ch03/. If you need reminders about how to create files in Xcode, flip back a few pages to an example earlier in the chapter.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial