ENGLISH

Learn C on the Mac: For OS X and IOS

Book information

Publisher
Apress
Year
2012
ISBN
1430245336, 9781430245339
Language
english
Format
PDF
Filesize
7 MB (7490991 bytes)
Edition
2
Pages
508\502
Time added
2021-07-15 05:25:41

Description

Considered a classic by an entire generation of Mac programmers, Dave Mark's Learn C on the Machas been updated for you to include Mac OS X Mountain Lion and the latest iOS considerations. Learn C on the Mac: For OS X and iOS, Second Edition is perfect for beginners learning to program. It includes contemporary OS X and iOSexamples! This book also does the following: Provides best practices for programming newbies Presents all the basics with a pragmatic, Mac OS X and iOS -flavored approach Includes updated source code which is fully compatible with latest Xcode What you'll learn Master C programming, the gateway to programming your Mac, iPhone or iPad Write apps for the contemporary Mac OS X interface, the cleanest user interface around Write apps for the modern iOS interface, one of the two most popular mobile platforms in the world Understand variables and how to design your own data structures Work with the file system Connect to data sources and the Internet How to handle error handling and much more Who this book is for For anyone wanting to learn to program in Mac OS X and iOS, including developers new to the Mac and iPhone/iPad, developers new to C, or students entirely new to programming. Table of Contents Chapter 1: Go Get the Tools Chapter 2. Programming Basics Chapter 3: C Basics: Staements and Functions Chapter 4: C Basics: Variables and Operators Chapter 5: Debugging Chapter 6: Controlling Your Program's Flow Chapter 7: Pointers and Parameters Chapter 8: More Data Types Chapter 9: The Command Line Chapter 10: Designing Your Own Data Structures Chapter 11: Working with Files Chapter 12: Handling Errors Chapter 13: Advanced Topics Chapter 14: Where Do You Go from Here? Chapter 15: Answers to Exercises Cover Contents at a Glance Contents About the Authors About the Technical Reviewer Acknowledgments Introduction Chapter 1 Go Get the Tools! Installing Xcode How much is that IDE in the Window? What’s a Registered Developer? Getting the Projects Using Xcode Creating a New Xcode Project The Workspace Window Running a Project Moving On Chapter 2 Programming Basics Programming Some Alternatives to C What About Objective-C, C#, C++, and Java? What’s the Best Programming Language for the Mac or iOS Devices? The Programming Process Source Code Compiling Your Source Code Building Your Application What’s Next? Chapter 3 C Basics: Statements and Functions C Statements C Functions Defining a Function Syntax Errors and Algorithms Calling a Function Same Program, Two Functions The Hello2 Project The Hello2 Source Code Running Hello2 Doing That Again, and Again, and Again Generating Some Errors Fixing the Problem Getting Close C is Case Sensitive Exploring Xcode’s Built-In Manuals Getting Help Quickly What’s Next? Chapter 4 C Basics: Variables and Operators An Introduction to Variables Working with Variables Variable Names The Size of a Type Bytes and Bits Going from 1 Byte to 2 Bytes Operators The +, -, ++, and -- Operators The += and -= Operators The *, /, %, *=, /=, and %= Operators Using Parentheses Operator Precedence Sample Programs Opening Operator.xcodeproj Stepping Through the Operator Source Code Opening Postfix.xcode Stepping Through the Postfix Source Code Sprucing Up Your Code Source Code Spacing Comment Your Code The Curly Brace Controversy What’s Next? Chapter 5 Debugging What’s a Debugger? Controlling Execution Setting Breakpoints Stepping Over a Statement Stepping Into a Function Stepping Out of a Function Full Speed Ahead Examining Variables How is a Debugger like an Iceberg? What’s Next? Chapter 6 Controlling Your Program’s Flow Flow Control The if Statement Expressions True Expressions Comparative Operators Logical Operators TruthTester.xcodeproj Compound Expressions Statements The Curly Braces Where to Place the Semicolon Two Common Pitfalls The while Statement The for Statement LoopTester.xcodeproj The do Statement The switch Statement A case with No Statements The Mixed Blessing of Fall-Through switch Wrap-Up Breaks in Loops The continue Statement IsOdd.xcodeproj Stepping Through the IsOdd Source Code NextPrime.xcodeproj Stepping Through the NextPrime Source Code What’s Next? Chapter 7 Pointers and Parameters What Is a Pointer? Why Use Pointers? Checking Out of the Library Pointer Basics The Address of a Variable The & Operator Declaring a Pointer Variable The * Operator Function Parameters Variable Scope How Function Parameters Work Parameters Are Temporary The Difference Between Arguments and Parameters Function Return Value printf() Returns a Value Multiple Return Statements Returning Nothing at All Putting it All Together Using Pointers as Parameters Factor.xcodeproj Some Pointers on Pointers Pass-By-Value vs. Pass-By-Reference The NULL Pointer Value The Dark Side of Pointers Global and Static Variables Global Variables Adding Globals to Your Programs Static Variables What’s Next? Chapter 8 More Data Types Data Types Beyond Int FloatSizer The Integer Types IntSizer.xcodeproj The Long and Short of ints The Best int for the Job Semantic Types Exact-Width Types Integer vs. Floating Point Working with Characters The ASCII Character Set ASCII.xcodeproj Stepping Through the ASCII Source Code Arrays Why Use Arrays? Dice.xcode Stepping Through the Dice Source Code Danger, Will Robinson! The #define Directive Using #defines in Your Code Stepping Through the Preprocessor The Advantages of Using #define Directives Function-like #define Macros Text Strings A Text String in Memory FullName.xcodeproj Overflow.xcodeproj What’s Next? Chapter 9 The Command Line Command Line Basics Command Arguments Learning More About Commands Where Shell Commands Come From Creating a Command-Line Tool Command Arguments and main() SeeArgs.xcodeproj Deploying the Program Using Paths Current Directory and Relative Paths Special Directory Names The Home Directory Name Installing a Command-Line Tool Creating a Private bin Directory Installing the Tool Configuring the PATH Variable Character Input Pipes Redirection Namer.xcodeproj Pointer Arithmetic Comparing Pointers Pointer Addition Subtracting Pointers WordCount.xcodeproj Stepping Through the WordCount Source Code Testing WordCount in the Shell RomanNumeral.xcodeproj main() NumberToRomanNumeral() One Last Word About the Command-Line Interface What’s Next? Chapter 10 Designing Your Own Data Structures Bundling Data Model A: Three Arrays MultiArray.xcodeproj Model B: The Structure Approach StructSize.xcodeproj Passing a struct As a Parameter Passing a Copy of the struct ParamAddress.xcodeproj struct Arrays Allocating Your Own Memory Using malloc() free() Keeping Track of That Address! Working with Linked Lists Why Use Linked Lists? Creating a Linked List DVDTracker.xcodeproj Stepping Through the DVDTracker Source Code What’s Next? Chapter 11 Working With Files What Is a Data File? File Basics Understanding File Names Opening and Closing a File Reading a File PrintFile.xcodeproj Stepping Through the PrintFile Source Code Writing Files DVDFiler.xcodeproj Fancier File Manipulation The Update Modes Random File Access Using Random Access Functions DinoEdit.xcodeproj Text vs. Data Files Working with Endians Making RomanNumeral a Better Tool Stepping Through RomanNumeral.xcodeproj Putting RomanNumeral Through Its Paces File System Objects What’s Next? Chapter 12 Handling Errors Murphy’s Law Rule #1: Never Assume Assumptions About Variables Check Ranges Tolerate All Possible Values Assert Your Assumptions Rule #2: Stay Alert Pay Attention to Return Values errno Rule #3: Have an Escape Plan Follow the Success Early Return Skip Past Failure Percolate Errors Up Exit, Stage Left The Long Jump Rule #4: Anticipate Problems Rule #5: Pick Your Battles What’s Next? Chapter 13 Advanced Topics Type Conversion Conversion Rules Conversion Warnings Typecasting Typecasting Pointers const Modifier Creating Your Own Types struct typedefs Forward References Enumerated Types Unions Why Use Unions? Recursion The Iterative Approach A Recursive Approach Function Pointers The Remaining Operators Getting More From The Libraries Sorting with the Standard Library Collections in Core Foundation What’s Next? Chapter 14 Where Do You Go from Here? The Mac User Interface Learning Objective-C Learning Cocoa and Cocoa Touch A Bit of OS X Code A Quick iOS App Just a Touch of Objective-C Go Get ‘Em Appendix: Answers to Exercises Index Numers and Symbols A B C D E F G H I, J K L M N O P Q R S T U V W X, Y Z

Similar books

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

2010 · PDF

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

1858 · PDF

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

2022 · PDF

The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians

The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians

1809 · PDF

Professional Linux kernel architecture ''Wrox programmer to programmer''--Cover. - ''What you are reading right now is the result of an evolution over more than seven years: After two years of writing, the first edition was published in German by Carl Hanser Verlag in 2003. It then described kernel 2.6.0. The test was used as a basis for the low-level design documentation for the EAL4+ security evaluation of Red Hat Enterprise Linux 5, requiring to update it to kernel 2.6.18 (if the EAL acronym does not mean anything to you, then Wikipedia is once more your friend). Hewlett-Packard sponsored the translation into English and has, thankfully, granted the rights to publish the result. Updates to kernel 2.6.24 were then performed specifically for this book''--P. ix

Professional Linux kernel architecture ''Wrox programmer to programmer''--Cover. - ''What you are reading right now is the result of an evolution over more than seven years: After two years of writing, the first edition was published in German by Carl Hanser Verlag in 2003. It then described kernel 2.6.0. The test was used as a basis for the low-level design documentation for the EAL4+ security evaluation of Red Hat Enterprise Linux 5, requiring to update it to kernel 2.6.18 (if the EAL acronym does not mean anything to you, then Wikipedia is once more your friend). Hewlett-Packard sponsored the translation into English and has, thankfully, granted the rights to publish the result. Updates to kernel 2.6.24 were then performed specifically for this book''--P. ix

2008 · PDF