3.3. Writing Your Code
Most of your time in Xcode will be spent reading and writing the source files that make up your program. Xcode's source code editor has a number of features to make this time as productive as possible. Some of these features are passive, such as drawing different parts of your source code in different colors or styles. This helps you quickly recognize elements of your program at a glance. Other features are active, such as providing commands for quickly formatting large areas of code.
In the following example you write a small C program called Calculator that lets you add and subtract numbers. The program consists of two functions: the main function, which interacts with the user using Mac OS X's command-line interface, and a calculate function that does some arithmetic. The calculate function takes two numbers and an operator and returns the result of applying the operator to the numbers. If you aren't familiar with the C programming language, don't worry too much about what the code is doing; this is really just a chance to get used to Xcode's text editor. Alternatively, you can skip ahead to Chapter 6 where you learn about writing programs in C.
3.3.1.
3.3.1.1. Try It Out: Working in the Code Editor
Choose XcodePreferences. Xcode's Preferences window appears.
If necessary, select the General preference pane.
Check the Open Counterparts In Same Window button. ...
Get Beginning Mac OS® X Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.