`
`its: 1.3101: arm/1.3.3] 5131?
`
`
`LG m2 @WQQETTIHTJ. ".1 g
`:12Maggy-.1114
`$21711?151aIf!zl’fi}W
`V'fiffla; LEEflTBG/
`{Eimgéiiié
`
`{4:52; (E {(0 [QB E1311}-
`(éfamfl 11E};- 'I'Ifai: 5333:-
`I 221:: :- imam
`
`i
`:
`I
`
`—
`
`'"' fill-1]}
`.,—-:- '1"
`-
`.
`5* WIUUIE‘JHIE“J'EIEDHQT
`I
`I'
`#
`{mm-K3 '-i-'-El-"J"'"[I-E 2—"—
`*1 r" "‘1'
`iii? FUTLEH.
`' A; a' "fail rmWEE" .13»a @3541! w -
`--
`‘ m I g 'fi'ityfimi‘m‘rtfirmm—t:
`
`IPR2020-00846
`
`‘6?
`' d"
`" -
`r: if: '-
`.11:.1453... arsgflkfi :3’
`fix;
`«Googl Exhibit 155
`Google Exhibit 1055
`Google v. Parus
`Q Google V. Parus
`IPR2020-00846
`
`
`
`VOLLF‘V’LE I
`
`by Dan Gookin
`
`fill!!!
`
`BOOKS
`WORLDMDE
`
`IDG Books Worldwide, Inc.
`An International Data Group Company
`
`Foster City, CA 0 Chicago, IL o Indianapolis, IN 0 Southlake. TX
`
`
`
`C For Dummies”, Volume I
`Published by
`1136 Books Worldwide, Inc.
`An International Data Group Company
`919 E. Hillsdale Blvd.
`Suite 400
`Foster City. CA 94404
`n n n . ‘ oghooks . com (IDG Books Worldwide Web Site)
`”.319: r" (mm .dummi es . com (Dummies Press Web Site)
`
`Copyright © 1996 IDG Books Worldwide. Inc. All rights reserved. No part at this book. including interlor design. cover
`design. and icons, may be reproduced or transmitted in any form, by any means (eiectronlc. photocopying. recording.
`or otherwise) without the prior written permission of the publisher.
`Library of Congress Catalog Card No.: 94-77739
`ISBN:
`IGIBDSSTS-Q
`
`Printed in the United States oi America
`
`10 9 8 7 6 5
`
`lAg’QWlRRiZWJBR-IN
`Distributed in the United States by IDG Books Worldwide. inc.
`
`Distributed by Macmillan Canada for Canada: by Contemporanea de Ediciones lor Venezuela: by Distribuidora Cuspide
`for Argentina; by Cl'l'EC for Brazil; by Ediciones ZETA S.C.R. Ltda. for Peru; by Editorial Limusa SA for Mexico; by
`Transworld Publishers Limited in the United Kingdom and Europe: by Academic Bookshop for Egypt: by Levant
`Distributors 5.A.R.L. for Lebanon; by Al Jassim for Saudi Arabia; by Simron Pty. Ltd. for South Africa: by Pustalt Malia]
`for lndia; by The Computer Bookshop for lndia; by Toppan Company Ltd. for Japan: by Addison Wesley Publishing
`Company for Korea; by Longman Singapore Publishers Ltd. for Singapore. Malaysia. Thailand, and indonesia; by Unalis
`Corporation tor Taiwan; by W5 Computer Publishing Company. Inc. for the Philippines; by WoodsLane Pty. Ltd. for
`Australia: by WoodsLane Enterprises Ltd. for New Zealand. Authorized Sales Agent: Anthony Rudkin Associates for the
`Middle East and North Africa.
`
`For general information on IDG Books Worldwide‘s books In the U.S.. please call our Consumer Customer Service
`department at 800-762-2974. For reseller information. including discounts and premium sales, please call our Reseller
`Customer Service department at 800-434-3422.
`
`For information on where to purchase IDG Books Worldwide's books outside the U.S.. please contact our International
`Sales department at 4115-6554-1172 or fax 415-655-3295.
`
`For information on foreign language translations, please contact our Foreign 8: Subsidiary Rights department at
`415-655-3021 or fax 415-655-3281.
`-
`
`For sales inquiries and special prices for bulk quantities. please contact our Sales department at 415655-3200 or write
`to the address above.
`
`For information on using 106 Books Worldwide's books in the classroom or for ordering examination copies. please
`contact our Educational Sales department at 800-434-2086 or fax 817-251-8174.
`
`For authorization to photocopy items for corporate. personal. or educational use. please contact Copyright Clearance-
`Center. 222 Rosewood Drive. Danvers. MA01923. or fax 508-750-4470.
`
`
`WW: AUTHOR AND PUBLISHER HAVE USED THEIR BEST EFFORTS IN
`PREPARING THIS BOOK. lDG BOOKS WORLDWIDE. INC.. AND AUTHOR MAKE NO REPRESENTATIONS OR
`
`
`WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS BOOK AND
`SPECIFICALLY DISCLAIM ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
`PURPOSE. THERE ARE NO WARRANTIEE WHICH EXTEND BEYOND THE DESCRIPTIONS CONTAINED IN THIS
`
`
`PARAGRAPH. NO WARRANTY MAY BE CREATED OR EXTENDED BY SMES REPRESENTATIVES ORWRITTEN SALES
`NIATERIAIS. THEACCURACYAND COMPIETENESS OFTHE INFORMATION PROVIDED HEREINANDTI-IE OPINIONS
`
`STATED HEREIN ARE NOT GUARANTEED OR WARRANTEl) TO PRODUCE ANY PARTICUIAR RESULTS, AND THE
`
`ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE EUR EVERY INDIVIDUAL. NEITHER [DG
`
`BOOKS WORLDWIDE, INC., NOR AUTHOR SHALL BE LIABLE FOR ANY LOSS OF PROFIT OR ANY OTHER
`
`COMMERCIAL DAMAGES. INCLUDING BUT NOT LIMITED TO SPECIAL, INCIDENTAL. CONSEQUENTIAL OR OTHER
`DAMAGES.
`
`Trademarks: All brand names and product names used in this book are trade names, service marks. trademarks. or
`registered trademarks of their respective owners. 106 Books Worldwide is not associated with any product or vendor
`mentioned in this book.
`
`Ill—a= is a trademark under exclusive
`IDG license to [DC Books Worldwidel lnc.,
`.
`from international Data Group. inc.
`BOURS
`
`7329;96
`
`
`
`
`
`
`
`
`‘ ABOUT IDG BOOKS WORLDWID
`
`lame to the world of IDG Books Worldwide.
`
`
`
`1 ' Books Worldwide. inn, is a subsidiary of International Deta Group. the world‘s largest ' " b ,
`
`{petitioner-related information and the leading global provider of information services ctr-information
`m _
`_
`
`1116 was {omitted more than 25 years ago and now employs more than 8.500 peoplewot‘ldwide‘. {06 on
`
`more then 275 computer publications in over 75 countries (see listing below). More than 60' million '
`_
`
`'
`"read one or more lDG publications each month.
`
`launched in 1990. IDG Books Worldwide is today the #1 publisher of best-selling ctimputer-booksimtlte'
`United States. We are proud to have received eight awards from the Computer Press Association management - ‘ *
`of editorial excellenceand three from Computer Currents‘ First Annual Readers‘ Choice Awards. Gor'best-
`selling ...For Dummies” series has more than 30 million copies in print with translations in 30 languages. ID'G"
`Books Worldwide. through a joint venture with IDG's Hi-Tech Beijing. became the iirst US. publisher to
`publish a computer book in the People’s Republic of China. in record time. lDG Books Vibrldwide has beoome '
`the first choice for millions of readers around the world who want to learn how to better manage their
`businesses.
`
`
`
`
`
`.
`
`'
`.
`l
`
`.
`I
`
`
`
`‘
`
`
`
`'
`
`.
`1
`
`
`
`
`
`
`
`
`
`
`
`
`Our mission is simple: Every one of our books is designed to bring extra value and skill»buildin'g instructions:
`to the reader. Our books are written by experts who understand and care about our readers. The knowledge
`base of our editorial staff comes {rorn years of experience in publishing. education. and journalism —
`experience we use to produce books for the ‘905. In short. we care about books, so we attract the best people.
`We devote special attention to-details-such as audience. interior design, use of icons, and illustrations. And.
`because we use an efficient process of authoring. editing. and desktop publishing our books electronically
`we can spend more time ensuring superior oontent and spend less time on the technicalities 'o'f trial-ongboolts
`You can count on our-commitment to deliver high-quality books at competitive prices on topics'youfiiianl
`.
`
`
`to read about. At iDG Books Vibrldwide. we continue in the IDG tradition of delivering qualitylol‘ more-;_'t_bai_r
`.
`
`
`25 years. You'll find no better book on a subject than one from IDG Books Worldwide.
`.-
`'
`'
`'
`
`filbfllw“
`
`_
`john Kilcullen
`
`and so
`
`
`
`
`
`
`WINNER
`
`murmur
`“cm“"’”Wm
`3
`
`WINNER
`
`WINNER
`
`MAM
`ml ”33
`3'
`
`WINNER
`mum
`NinthAmloal'
`WM
`Coma-mm
`amateur
`swarm
`lDGBooltslllnIdwide. loc..isa Mortimer-MIMI Dmeuleu world‘s largest publlsluoltompmr‘rlbtod Winn :rndllu lcxlingglahil pauritietolinlmnmoo semen lnlnlroatian Iotllmloge International
`Data rectum-uour: 275mmpulu mm In overis counties Sinsmillion people Mmormbuemoioml Dorm
`ptlltlimtinnseaelimotuh. ImermtioauleGmup'sptililitatlonslndude: ARGENTINA:
`Below .(Jooqmterunrld Argonne. PCWHAwgemu-a: numri’ulflnliau eunmdeuiu-alizn Pc“\rl|l,mll§bn
`runs. (Immoral. ”Molt. Nflmtlt World. ammonium AUS‘nIIA:
`Curl
`it Oslo-rode mnwmmmmm; BANGLalDESItPCWbu-Id Mtglukdr. mus: mmmmmu: on: News; mam.- mmiodclnlnmwb.cwflplkmflfu.t‘muxuiolfi Mamet-Id.
`PC
`tr. PC use. Publish. Reseller News. Superstar-cam:BULGARlA: Commend Ilu
`' .Networkllbfid Elam. PClslherrlrl Bill
`'aLCANADA: Cloerratic. (EmoticonWHLoounided Cmada.
`InluWotltl CIDIIII,NEMI*\WIIC1CITflh \Whllbtld:
`IILF; Commoner“ Chile. PC lib
`Chilr;CDLOMBlk CmoptnerworldCulnrobil. Pgabrld Columbia; CDSIA RICA: PC “lurid. Centre Writs; THE CZECH
`AND SLOVAK REPUILLIG: Conwmmld Cndlulimltil, Maraudd Czedl Republic. PCVAaid Czechoslovakia; DENMARK: Camounlcatlom \llil'ld Danrrurlt. Cotnpuimofld Dotumrkjlmrlrl Denmark. PC “brill
`Denmark. Iethlwld Deumalit; DOMINICAN REPUBLIC: PC World
`in Damiadaoa: ECUADOR: PC Wand Ecuador; EG‘I'FI: Cornpmurlrl Middle East. PC \ihrlrl Middle East: EL SALVADOR: PC “brill Ctntm
`Astoria; FINLANlit Mlloo'PC. Tutor-edit». Tutovilidto: FRANCE: but
`uilque.l-Iebdo. InEo'PC. Le Monde lnlonoadmr. lien-odd. Rem oileloconu. “Wu FranoeLC‘EItHANE Com
`Partner. Cornwuwvdie.
`Comptonuoche Eton. Computer-welt: Foulsfiloboi 0min. Whitman 6mm (20me 61um GremJluliimdil llbddLGlJA‘l'E‘MALA: FEM Comm Aurelia: EINIIURJS: PCllabrldeIro
`Autism; IIONG KONG: Compmlm‘crld llo
`Koo led flung Kong. Midterm: HUNGARY: ABCD DROP-I. Coomumrld Sumuuodmiltmmmnro collate)
`'
`PCW'arld Hm PC-il Haydn Hungary.
`lCEL-IND: TaliululmutPC Wind IslmddN IA:
`lorowlon Cmmuoiulinru “brill. Inlormhon Siam Conwtemorlii. PC “In-Id ledl:.MlisI1 InAsix INDONESIA: In
`PC“btld.l(on1punckCn-n mild.
`Publish in also: IRENE}: Compute-Scope, PC Lhel: ISRAEL: llamlld Israel. People StCompultrleom summit];I‘LALY:Computemorldlulh.IlIatworltl1lrlia.th-vodtln§llalio. PC World halls:jAPAN: TP “brill.
`Stace'eflilhpln. Nlllteil’moml commons “brill Jaipur. Smilibildjipm. ModmsmubdeI-in oil-s “Wjapmzmk PCWorld militia—til; KOIII-Ik Hi-Iecli ln amullonllarworld Korea. PCWnrlrI Kora;
`M1CEDOSHLPCWorld modem-.mtm‘uu Counptuerwrltl luhmxllbrld mist-sh. hilalidtiilAMMMIA: PCilbrltl Malta; MEXICO: Cumpmemorld Motion PCVbdrl WWANMAR: PCWorld Minimum:
`NETHERLANDS: Compton". Total. IAN Immmfldngmm. LAN Wot-Idler“: Guide. World Netherlands. Nfl.m\‘hflld‘,fliw ZI-ZALAND: Absolute Beginners kalmid Plalnéi'Simple Sellflflfompula My“.
`-
`Indusry {brutal}; Com termrldNeI' I’xalmd. NIB. Nomi: “brill. PCilbrlrl Neeraland; NICARAGUA: PCVhrld Centre Aim-11:3; NORWAY;
`modal Home. CWRI poll. Deumgrslnrt. Rwanda]
`
`ge'd: Serge. lhcwr d Norse. lhtlu'uledlnmlltl Mtge. PC “will MNWJCDWH Neuirrlt. PCWNIII
`‘
`.PC \lllirld MIGUEL Norgtfl lilS'l’A'N: Compmt
`I‘llIiSLIIllmNdm: I’Cllbrld.
`
`PEOPLE'S REPUBLIC OF CHINA: Chin Cuomzrllsm. Grim Colopiilemld.0tim Infollblld. CItim‘Feltt-om ‘A
`dubeltllt Conwatétfiomuwniodo‘n. EmmoltDtilglflmfionmolu Today. Ebororlts
`i.- .m. PC World Chin. Poplin-Com Il‘lfl “kit. Software Illrcltly. Selim “bi-Id. i‘eieeom “bu-Id; PERU: Cmupumollcl Pm. PC World Delusional Peru. PC World Selle PEN: PHILIPPINES: Clicltl.
`
`iries. PC World Philippines, Publish in Ana; POLAND: Compumlld Poland. Compuhemnlld
`tlzl Report Poland. Cybrr. Netwolitl Poland. Neiworld Poland. PC \lbrirl Knopulm PORTUGAL-
`iiemDIWCLVI'I'tiD inlonutltito. Hominid PonuraL Mac'IanC'ln New. Multllmlla \lb :I‘IJElIO RICO: PC would Poem 'Itiro; ROMANIA: Commit-Id mil. PC “lurid Rmuauia.
`sSLA:
`'
`uteruurld Russia. llirPILPublisbjniLSthflPOItE: Con:
`em
`Simpler: Pcllbrld Sl‘rtgapolt. hihhih inAsIa; SLOW l-loolioeSOUTH AFIICA:
`MESA. Neiwoi‘kWoI‘lIl
`
`'
`tamorslliidtl Emanmpmm'ufldlml‘m.
`tl’i'mldfimllmfid
`PCerdEspafntsfl LANIM: lofolinlti’Cl’vhdd;5WEDEN:W
`Colmmcrfiwudm.
`'
`W‘d Sweden. itltmischm. lllmwld Sumo. Momma Milan. hfikmDIlom, mull 5‘! Kommumlmiom. PC “brill Sweden. Palm's. Windows M en: 5“}!!me
`
`
`lip‘ TAIWAN: ComputemurldTaiwan. named Tait-m. NEWVilflhll'l’lililish. PC “odd Tam. “indoor-SM Trim: MILAND: Publish in Ash. Tln‘l Contpuherworld:
`-
`‘
`tit-orig \t'or d Twin); Pcmirld Tutti}: UKRAINE: Cum Inter-world Kiev, Multimedia World UloaincJCerd limbo: UNITED KINGDOM: Aromllser UKAIvfiga
`.imu'orld.Pans.deommueI-s UK. 'PC divisor.
`Hollie.PSKP'm.1l3e WEB: UNITED STATES: Czhlcln the Classroom. CID Magnum. Computznwld.“
`
`..:l. l-li'iy: slam-arid. 51:1ka “brill. PC (mots. PCWmld, Puhbsltflulm Emujlii www.mwm unlit: webeiiiEeJaiqutld. Numwdd,
`'FSEIL'ELA: CmptbenwldVent/ztuli. PCllhtldYem‘deh: 1nd VIETNAM: PCiI'otItll-launm
`[WW6
`_
`
`
`
`
` —-——__
`
`Chapter 1: The (Sometimes Painless) Beginner Stuff
`
`9
`
`: C program-
`
`Early .705. At
`Bell. The next
`
`Dennis
`1d
`m fig?pen
`1 I am.” And
`
`Lesson 1-7 Quiz
`
`1. C comes from a programming language called:
`
`A. A.
`B. B.
`
`C. Sea.
`D. Primordial C.
`
`2. The B language stood for:
`
`A. Before C Language.
`B. Better than the A Programming Language.
`C. Bill & Ted‘s Excellent Programming Language.
`
`D. Bell Labs Programming Language.
`
`a
`
`
`A. A.
`
`3. If they came up with another language after C, it would probably be called:
`
`
`evels
`faster than
`Iwrite them.
`
`
`
`
`
`
`
`
`$38369 like
`com-
`9 Within a C
`$539”?
`mo -
`:e of speed
`(e to some
`
`"33:3”:33‘5
`Aim:
`
`lords—or
`'vowels or
`ing,
`
`
`
`
`
`
`
`
`
`
`Emmi
`”Warts.
`
`. be larger.
`
`
`
`B. B.
`C D
`'
`'
`D. All of the above.
`4. C is a:
`A. Low-level language.
`B. Mid-level language.
`C. High-level language.
`D.
`I thought we weren’t required to know stuff in the Techy boxes.
`
`Lesson 7-2: How a Meek and Mild
`Text File 8ecomes a Program
`
`When you create a program, you become a programmer. I know, the term is
`new to you. Still, your relatives or people you lmow may refer to you as a “com—
`puter operator” or “wizard" even though your association with the beast is passing
`
`at best. So hang thetitle of Programmer on your shingle and swell with pride.
`Ahhh .
`. ..
`
`
`
`70
`
`c For Dununias. Volume I
`
`
`
`Now that you are a programmer, what's your job? Obviously, it's to write
`programs. But programs should have a. purpose. The purpose is to make the
`computer do something.
`
`The object of programming is to “melee it happen.” The C language is only a tool
`for communicating with the PC.
`
`It’s your job as a programmer to translate the intentions of users into some-
`thing the computer understands and then give users what they want. And if you
`can't give them what they want. at least make it close enough so that they don’t
`constantly complain or — worse — want their money back.
`
`5’ i could offer a lot of philosophical advice about writing friendly programs
`and keeping in mind that the user isn‘t that smart. but, naaah.
`
`I“ Concentrate on who’s using the program and make sure that their needs
`are being met. Granted. this is advanced stuff: at this point. the struggle is
`just getting it to work
`
`The C development cycle
`Here is how you create a C program in nine steps — in what’s known as the
`development cycle:
`
`your friends that you’re woefully entrenched in the throes of a C language
`
`1. Come up with idea for program.
`
`2. Use editor to write source code.
`
`3. Compile program by using C compiler.
`
`4. Weep bitterly over errors (optional).
`
`5. Link program with linker.
`
`' 6. Weep bitterly over errors (optional).
`
`7. Run program and test.
`
`8. Pull out hair over bugs (optional).
`
`9. Start over (required).
`
`No need to memorize this list. It's like the instructions on a shampoo bottle
`(which are there. by the way, if you haven't been bored. as [was recently, and
`resorted to reading a shampoo bottle for lack of other reading materials in the
`place where you shower — and do other stuff). No one reads shampoo instruc-
`tions because we all know how to shampoo our hair. You’ll soon be working
`through these steps often enough that you won't have to memorize them.
`
`'
`
`(Knowing about the “development cycle” is neat, though. You can complain to
`
`
`
`
`
`Y. it‘s to write
`so is to make the
`
`Iguage is only a toe.
`
`sent into some-
`
`le)’ want. And if yOL
`1 so that they don't
`
`'riendly programs
`Iaaah.
`
`that their needs
`nt, the struggle is
`
`known as the
`
`11300 bottle
`recently, and
`aterlals in the
`unpoo instruc-
`be Working
`ize them.
`
`I complain to
`language
`
`
`
`Chapter 1: The (Sometimes Painless) Beginner Stuff
`
`77
`
`development cycle. Watch their eyes widen as you impress them with your
`programming knowledge!)
`
`V Step 1 is the hardest. The rest fall naturally into place.
`
`V This really will become shampoo-easy to you in just a few lessons.
`
`The source code
`
`When you create a program, you tell the computer what to do. Since the
`computer can’t understand speech and since hitting it — no matter what
`emotional value that has for you — does little to the PC. your final line of
`communications is to write the computer a note — a file on disk.
`
`To create the note, you use a program called a text editor: This is a primitive
`version of a word processor, minus all the fancy formatting and printing
`controls. The text editor lets you type text — that’s about all.
`
`Using your text editor, you create what‘s called a source code file. The only
`special thing about this file is that it contains instructions which tell the
`computer what to do. And although it would be nice to write instructions like
`“Make a funny noise." the truth is that you must write instructions in a tongue
`the computer understands. In this case, the instructions are written in the C
`language.
`
`When you‘ve finished writing the instructions, you save them in a file on disk.
`Have the first part of the filename be the name you want to give the final
`program. For example, if you were creating a game called UFO Kill, the source
`code file should have a first name of UFOKlLL.
`
`The second part of the illename, the extension, must be C, for the C language.
`This is important! Most text files end in TXT or sometimes DOC. For the C
`language, your files must end in .C (dot—C), such as UFOKlLL.C.
`
`1/ The source code file is a text file on disk. It contains instructions for the
`computer that are written in the C programming language.
`
`1/ You use a text editor to create the source code file. Most C compilers
`come with their own text editors. If yours did not, you can use a third-
`party text editor to do the job. (Some programmers prefer third-party text
`editors.)
`
`V It's possible to use a word processor to create your source code files.
`However, save the file as a “plain text” or “DOS text” or “ASCII” or
`“unformatted” file. (Using a word processor to create a source code file is
`a lot like using a 747 to drive to work; it’s a little too much power for the
`job at hand.)
`
`1’ The source code file ends with a C as Its filename extension.
`
`
`
`
`
`72
`
`CForDummies, Volumel
`
`V The first part of the source code filename should be the name of the
`program you want to create.
`
`V Be clever when you name your source code.
`
`7119 compiler
`
`After the source code is created and saved to disk, it must be translated into a
`language the computer can understand. This job is tackled by the compiler.
`
`The compiler is a special program that reads the instructions stored in the
`source code file. The compiler runs through each instruction and translates it
`into the secret code understood only by the computer's microprocessor.
`
`If all goes well and the compiler is duly pleased with your source code, it
`producesan object code file, a second file that's saved on disk. The object
`code file has the same first name as the source code file. but it ends in .03.!
`(dot-03.1). So for that UFO game, it would be UFOKILLOBJ.
`
`If the compiler doesn't understand something, it displays an error message on
`the screen. At that point, you can gnash your teeth and sit and stew. Then go
`back and edit the source code file again, fixing whatever error the compiler
`found. (This isn‘t as tough as it sounds.) Then you attempt to compile the
`program again -—- you recompile.
`
`After the compiler does its job, the program isn’t finished. A third step is
`required: linking. This subject is covered in the next section.
`
`V The compiler takes the information in the source code file and translates it
`into instructions the computer can understand. The result is a new file -
`the object file.
`'
`
`w The object file ends in OBI. The first part of the object file name is the
`same as the source code filename.
`
`1’ By the way, all these files are stored in the same directory. For information
`on cleaning them up, see Lesson 1-8.
`
`V Errors happen. When the compiler sees something it can‘t understand. it
`stops compiling and displays an error message on the screen. Although
`this sounds dreadful, the errors are really quite easy to fix. Lesson 1-4
`discusses how.
`V Some of the C lords call an object file’s contents object code. “The object
`file contains object code, you silly twit,” they spit at you through their
`teeth.
`
`
`
`a“ ”(453
`a}?
`3
`
`
`
`
` " fl—Lk_ __
`
`
`
`[me of the
`
`
`
`.' Curious, but not required. information on object files
`
`
`
`Chapter 1: The (Sometimes Painless) Beginner Stuff
`
`l3
`
`mslated into a
`lo compiler.
`
`red in the
`i translates it
`'ocessor.
`
`code. it
`re object
`ldS in .03.]
`
`I' message 0:]
`3w. Then go
`: compiler
`mile the
`
`step is
`
`d translates it
`a new file ——
`
`he is the
`
`r information
`
`lerstand, it
`Although
`:son 1-4
`
`‘he object
`:11 their
`
`Are objectfiles necessary? No, not really.Thay’re
`an intermediate step. From your source code/the
`compiler creates machine—language instructions
`that are directly understandable by the micro-
`processor. ltcouldatthatpointbuildmofinal program
`file foryou, but an UBJ file is created instead.
`
`deal with chapter-size files instead. For large
`programs. it makes sense to break them up into
`smalier pieces, or modules. Each module is com-
`piled separately, and several DBJ files are cre-
`ated. It's the Iinker’s job to string together, or link,
`the separate DBJ files into one EXE (or execut-
`able} file.
`
`The reasons for UBJ files come from when you
`At this point in your C programming career, the
`have large programming projects. Inthose cases,
`programs are too smallto warrant creating sepa-
`you’re usuallyworking with multiple source code
`rate sourcefiles and multiple 03.] files. The linker
`files. Why? Primarily to keep the program man-
`is still required, however. to convert the single
`ageable. For example, your word processor can
`03.! file into the final program file.
`hold a 500-page novel as one file, but'rt's easierto
`
`
`
`
`The linker
`
`The linker is a program, like the compiler. its job is to create the final program
`file.
`
`What the linker does is to take the OBJ file created by the compiler and spruce
`it up, producing the final program file. That file ends with either a COM or EXE
`extension — which is how program files are identified under DOS.
`
`The first part of the program filename is the same as the first part of the source
`code filename. So if you start with UFOKlLL.C. the compiler creates an object
`file, UFOKILLDBJ, and then the linker creates the final program file,
`UFOKILLEXE.
`
`f-f V In most DOS C compilers, both the compiler‘s and linker‘s jobs are done
`"
`together, One after the other. You may occasionally see “compile" and
`“link“ listed as two steps (which they are), but with your C compiler they
`may be combined into one.
`
`5 r/ Like the compiler, when the linker sees something it can't figure out, it
`"
`produces an error message. In that case. you have to decipher the error
`message and compile the program again (recompile). Lesson 1—4 deals
`with dealing with errors.
`
`: 1/ Text editor ED Compiler -:> Linker.
`
`1/ Source code IQ Object code Ii) Program.
`
`
`
`
`
`1 4
`
`C For Dummies. Volume I
`
`If The program file ends in EXE, though it's possible to tell the linker to
`create COM files. You can refer to your linker‘s documentation for pulling
`off that trick.
`
`3/ Yup, that’s right: From starting with a single source code file, you end up
`with three files on disk: UFOKJLLC, UFOKILLDBJ, and UFOKILLEXE. Some
`compilers may anoint your hard drive with even more files. Refer to
`Lesson 1—8 for information about managing everything.
`
`Lesson 1-2 Quiz
`
`1. How does a programmer translate the intentions of the user?
`
`A. Barely.
`
`B. By creating a program that lets the user accomplish some task, hope-
`fully the same task the user wants accomplished.
`
`C. Voodoo.
`
`D. Who said it was the programmer’s job to translate the intentions of the
`user?
`
`2. The C development cycle is:
`
`A. A stationary device you pedal to work off ugly fat.
`
`B. The steps required to create a program by using the C language.
`
`C. For older, more lethargic dogs.
`
`D. How our oceans were formed millions of years ago.
`
`3. Match the file on the left with the thing that creates it on the right:
`
`A. Source code file
`
`1. Text editor
`
`B. Object file
`
`C. Program file
`
`D. Francophile
`
`2. Compiler
`
`3. Linker
`
`4. France
`
`4. Which of the following describes the files used to create the STOMP pro-
`gram.
`-
`
`A. STOMP.C — STOMPDBJ — STOMP.EXE
`
`B. STOMP.C - STOMPEXE
`
`C. STOMP.C - STOMP.COM - STOMPEXE
`
`D. STOMP - LEFT, STOMP - RIGHT, STOMP, STOMP
`
`
`
`
`
`84
`
`C For Dummies. Volume I ———-—.—.———__
`
`
`
`3. Write a program that accepts input from the keyboard and stores it in a
`variable called name. The program then displays the output twice on the
`same line. For example. the output should look something like this:
`What
`is‘ your name? Fred
`Fred? My name is Fred tool
`
`4. When I see %5 in a pri ntf function, I know that:
`
`A. It must have a corresponding string variable later in that same pri n tf
`function.
`
`B. Something will be figured by percents.
`
`C. it‘s a variable thingamaboo.
`
`D. Gone, gone, gone are those carefree days of my youth.
`
`5. Which of the following is a literal string?
`
`A. The thing William Shakespeare used to tie up his boots.
`
`B. \"This is a string constant.\'
`
`C. "No,
`D. %s
`
`I'm a literal string!"
`
`It‘s time for a well-deserved rest. Please go take a break.
`
`
`Lesson 23: Remarks, Comments, and
`Suggestions
`
`An important part of programming is remembering what the heck it is you‘re
`doing. I'm not talking about the programming itself — that‘s easy to remember
`and there are books and references galore in case you don‘t. Instead. the thing
`you have to remember is what you are attempting to make a program do at a
`specific spot. This is done by inserting a comment in your source code.
`
`Comments aren‘t really necessary for the small programs you’re doing in this
`book. They don‘t begin to become necessary until you write larger programs —
`things on the scope of Excel or DOS — where it’s easy to lose your train of
`thought. To remind yourself of what you‘re doing. you should stick a comment
`in the source code. explaining your approach. That way, when you look at the
`source code again, your eyes don't glaze over and the drool doesn‘t pour,
`because the comments remind you of what‘s going on.
`
`Adt
`
`Comm
`betwee
`stick a
`runs.
`
`/* Th
`
`This is
`comme
`
`[a-
`
`Hello
`Ha! Ha
`Nye!
`h
`*l
`
`V Tht
`
`1/ The
`
`V Yu;
`
`V The
`afte
`
`A big
`
`The follm
`descri bet
`
`Name:
`
`’3:
`
`MAD L I B 1 .
`Written
`*1
`
`#1nci ude
`
`
`
`________________
`
`i and stores it in a
`
`
`
`ots.
`
`ma!
`
`186k it is you're
`
`re doing in um;
`’36!" programs -—
`our train of
`tick a comment
`V0" 1001: at the
`isn’t pour,
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`Chapter 2 Building (and Stumbling) Bin-eke of Basic 0 Programs 85
`
`Adding comments
`
`Comments in a C program have astarting point and an ending point. Everything
`between those two points is ignored by the compiler. meaning that you can
`stick any text in there — anything— and it doesn't affect how the program
`runs.
`
`
`
`This is a fine example at a comment. What iollows is another wan-role of a
`comment, but the type that gives this book its reputation:
`
`
`
`1/ The beginning of the comment is marked by the slash and asterisk: P.
`
`V The end of the comment is marked bythe asterisk and slash: *I.
`
`I! Yup, thefre different.
`
`I The conunent is not a C language statement. You do not need a semicolon
`after the *I.
`
`A big, hairy program with comments
`The following program is MADIIBI.C. It uses the pri ntf and scanf hmctions
`described in Lesson 2-2 to create a short yet interesting story.
`
`Name: MADLIBl.C
`
`
`
`
`
`
`
`
`8'6
`
`C For Dummies, Volume I
`
`-———_—_—
`
`
`
`void mainE}
`{
`
`char adjective£2@]:
`char foodEZB];
`char choreEZG];
`char furnitureEZfl]:
`
`/* Get the words to use in the modlib */
`
`pri ntfi "Enter an adjective: " ) :
`scanfi "$5“ ,adjecti re};
`pri ntf( “Enter a food: ”) :
`scanf("%s“.food):
`
`/* prompt */
`1* input *!
`
`printf(“Enter a household chore (past tense):“):
`scanft"%s“.chore):
`printf("Enter an item of furniture:"):
`scanfi 'xs' . furni tore}:
`
`I* Display the output *f
`
`printf("\n\nDon't touch that $5 %s!\n'.edjective,food);
`print-EU] just $5 the zsl\n".chore.furniture);
`
`
`
`
`Quick hints for entering MADUB1.C
`(if you still need them)
`
`The onlything newto you lnthis program should
`bethe comments. Each one beginswidi l* and
`ends with *I. Make sure that you get those
`right: slash-asterisk beginsthe commentand an
`asterisk—slash ends it They’re not boththe same.
`
`for each. Each of the string variables is filled by
`s canf with your keyboard input
`
`Each ofthefinal pri ntf functions containstwo
`$5 placeholders. Two string variables in each
`function supplythe textforthe $5 placeholders.
`
`MADLIBLC uses these four string variables:
`The second-to-last pri ntf function begins with
`adjective, food, chore, and furniture.
`Mo newline characters, \n \n. These charac-
`All four of them are created by the the r key-
`ters soperatethe inputsection, where you enter
`word, and 20 characters of storage are set aside
`the bits of text, from the program's output
`
`
`
`Typl
`help
`
`Save
`
`Com
`soun
`
`Here
`
`Efltl
`
`Entr
`Entr
`Ente
`
`Don'
`
`The M!
`comma
`
`progra:
`
`gs.
`MADLII
`Hr‘lttr
`*/
`
`Ever p0
`con-one]
`or such
`
`*I all by
`whole p1
`
`
`
`
`
`Chapter 2: Building (and Stumbling) Blocks of Basic 6 Programs
`
`87
`
`Type the program exactly as written earlier. Use the preceding Cheat sidebar to
`help you through it (if you need extra help).
`
`Save the file to disk and name it MADLIBI.C.
`
`Compile the file into MADLIBLEXE. if you have any errors, double-check the
`source code, reedit, recompile.
`
`Here is a sample of the program's output:
`
`Enter an adjectivemairy
`Enter a foodzwaffle
`
`Enter a household chore (past tenseiwacuumed
`Enter an item of furniturewouch
`
`touch that; hairy waffle!
`Don't
`I just vacuumed the couch!
`
`V This program is long and looks complex, but it doesn‘t use any new tricks.
`Everything here you’ve seen already: the creation of string variables with
`chat r, pri ntic to display text and string variables, and so an f to read the
`keyboard. Yawn.
`
`1/ There are five comments in MADLlBl.C. Make sure that you can find each
`one. Notice that they‘re not all the same, yet each begins with F and ends
`with *f.
`
`Comment styles of the nerdy and
`not-quite—yet—nerdy
`
`The MADLIBI.C program contains five comments and uses three different
`commenting styles. Though there are many more ways of commenting your
`programs, these are the most common:
`
`Ink.
`MADLIBl.C Source Code
`
`Written by Mike Rowsoft
`*/
`
`Ever popular is the multiline approach, shown here. The first line starts the
`comment with the /* all by itself. Lines following it are all comments, remarks,
`or such and are ignored by the compiler. The final line ends the comment with
`*I all by itself. Remember that final g”; otherwise, the C compiler thinks that your
`whole program is just one big, long comment (possible, but not recommended).
`
`mpt */
`ut */
`
`2.1mm);
`
`ables is filled by
`
`1‘s contains two
`nables in each
`5 placeholders,
`
`
`
`
`
`
`ion begins with
`l'hese charac-
`here You enter
`i output.
`
`
`
`
`
`88 C For Dummies. Volume I
`
`—-———_—_—_—__
`
`I" Get the words to use in the madlib *2“
`
`This is a single-line comment, not to be confused with a C language statement.
`The comment begins with F and ends with ‘3' all on the same line. This is 100
`percent okey-dokey, and because it‘s not astaternent, you don‘t need asemicolon.
`
`printft'Enter an adjective:“):
`
`/* prompt *!
`
`Fmally, there is the "end of line“ comment. After the preceding p ri nt f statement plus
`afewtaps of the Tab key, the /* starts a comment, and “3' ends it on the same line.
`
`Why are comments necessary?
`Comments aren’t necessary for the C compiler. It ignores them. Instead,
`comments are for you. the programmer. They offer bits of advice, suggestions
`for what you‘re trying to do, or hints on how the program works. You can put
`anything in the comments, though the more useful the information. the better it
`helps you later on.
`
`Most C programs begin with a few lines of comments. All my C programs start
`with information such as the following:
`
`
`
`/* MINICOM.C
`
`flan Gookin, 9/26/94 @ 2:45 a.In.
`My 'latest attempt
`to write a communications
`program in [1. wish me luck.
`*i
`
`These lines tell me what the program is about and when I started working min.
`
`In the source code itself, comments can be used as notes to yourself, such as:
`
`/* Find out why this doesn 't work *{
`
`Or this:
`
`save=itemv