throbber

`blishingphenome
`
`
`enon,
`PmCe “vorethanéAplut
`, ofthe|times.”
`| ae | ‘Dummies isasign
`
`coo | —TheNewYorkTimes
`commssonns
`
`
`se
`
`\
`
`=
`
`; Bg
`BookSeries
`
`|
`><—_,.
`, df
`||
`
`qj
`|
`
`=
`—_
`
`henaro
`
`
`
`ga
`
`J
`
`a T
`
` )oeaof
`
`
`ns.aa)andEasyWay
`—All|NeviEe
`yah fnw
`/ . Da = ; a ny os
`Learn C Programming
`—iA WV
`Oe
`@r
`A
`YourfFirstel|Kitfor
`ra |NCECI YEcc Or
`PrePrograms
`"
`ne | Ke oT Or Us!
`
`UseCtoTell Your—
`ne, Pray
`Ay
`supe
`
`
`fl (/
`eonmetetnasto
`i
`bylLU anGGookin
`
`“| Do—Explained—ae ryPlain English Sos
`AuthorofIDG's#1BestsellerDOSForDummies:
`
` eeeoy
`& ap\Coogle Exhibit 1055
`
`
`
`.&& y gC
`
`
`
`
`
`
`
`
`Google Exhibit 1055
`Google v. Parus
`‘Google v. Parus
`IPR2020-00846
`IPR2020-00846
`
`

`

`VOLUME |
`
`by Dan Gookin
`
`i—
`
`=—_
`
`IDG
`eee
`
`IDG Books Worldwide,Inc.
`An International Data Group Company
`
`Foster City, CA # Chicago,IL ¢ Indianapolis, IN ¢ Southlake, TX
`
`

`

`C For Dummies®, VolumeI
`Published by
`IDG Books Worldwide,Inc.
`An International Data Group Company
`919 E. Hillsdale Blvd.
`Suite 400
`Foster City, CA 94404
`www. idgbooks.com (DG Books Worldwide WebSite)
`attp://www.dummies.com (Dummies Press WebSite)
`Copyright © 1996 IDG Books Worldwide,Inc.All rights reserved. No part of this book, including interior design, cover
`design, and icons, may be reproduced or transmitted in any form, by any means(electronic, photocopying, recording,
`or otherwise) withoutthe prior written permissionof the publisher.
`Library of Congress Catalog Card No.: 94-77739
`ISBN: 1-878058-78-9
`
`Printed in the United States of America
`
`1098765
`
`1A/QW/RR/ZW/BR-IN
`Distributed in the United States by IDG Books Worldwide,Inc.
`Distributed by Macmillan Canada for Canada; by Contemporanea de Ediciones for Venezuela; by Distribuidora Cuspide
`for Argentina; by CITECfor 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 Bookshopfor Egypt; by Levant
`Distributors S.A.R.L. for Lebanon;byAl Jassim for Saudi Arabia; by Simron Pty. Ltd. for South Africa; by Pustak Mahal
`for India; by The Computer BookshopforIndia; by Toppan Company Ltd. for Japan; by Addison Wesley Publishing
`Companyfor Korea; by Longman SingaporePublishers Ltd. for Singapore, Malaysia, Thailand, and Indonesia; by Unalis
`Corporation for Taiwan; by WS Computer Publishing Company,Inc. for the Philippines; by WoodsLanePty.Ltd. for
`Australia; by WoodsLane Enterprises Ltd. for New Zealand. Authorized Sales Agent: Anthony Rudkin Associates for the
`Middle East and North Africa.
`Forgeneral 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 premiumsales, pleasecall our Reseller
`Customer Service departmentat 800-434-3422.
`Forinformation on where to purchase IDG Books Worldwide's books outside the U.S., please contact our International
`Sales departmentat 415-655-3172 or fax 415-655-3295.
`For information on foreign language translations, please contact our Foreign & Subsidiary Rights departmentat
`415-655-3021 or fax 415-655-3281.
`:
`Forsales inquiries and special prices for bulk quantities, please contact our Sales departmentat 415-655-3200 or write
`to the address above.
`For information on using IDG Books Worldwide’s books in the classroom orfor 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, MA 01923,or fax 508-750-4470.
`
`LIMITOFLIABILITY/DISCLAIMEROFWARRANTY: AUTHOR AND PUBLISHER HAVE USED THEIR BEST EFFORTS IN
`
`PREPARING THIS BOOK. IDG 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 WARRANTIES WHICH EXTEND BEYOND THE DESCRIPTIONS CONTAINED IN THIS
`
`
`PARAGRAPH. NOWARRANTY MAYBE CREATEDOREXTENDED BYSALESREPRESENTATIVES ORWRITTEN SALES
`MATERIALS. THEACCURACYAND COMPLETENESSOFTHEINFORMATION PROVIDEDHEREINANDTHE OPINIONS
`
`STATED HEREIN ARE NOT GUARANTEED OR WARRANTED TO PRODUCE ANY PARTICULAR RESULTS, AND THE
`
`ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY INDIVIDUAL. NEITHER IDG
`
`BOOKS WORLDWIDE, INC., NOR AUTHOR SHALL BE LIABLE FOR ANY LOSS OF PROFIT OR ANY OTHER
`
`COMMERCIAL DAMAGES,INCLUDING BUT NOTLIMITED TO SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR OTHER
`
`DAMAGES.
`Trademarks: All brand names and productnames usedin this book are trade names, service marks, trademarks,or
`registered trademarks oftheir respective owners. IDG Books Worldwideis not associated with any product or vendor
`mentioned in this book.
`
`ail
`
`is a trademark under exclusive
`license to IDG Books Worldwide,Inc.,
`from International Data Group,Inc.
`
`7/29/96
`
`

`

`_ ABOUT IDG BOOKS WORLDWID
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`Jcome to the world of IDG Books Worldwide.
`
`G Books Worldwide, Inc., is a subsidiary of International Data Group,the world’s largest publi
`computer-related information andthe leading global provider ofinformationservices oninformation
`techn
`
`TDG was founded more than 25 years ago and now employs more than 8,500 peopleworldwide. IDGpu
`
`‘more than 275 computer publications in over 75 countries (seelisting below). More than 60million pe
`
`tead one or more IDG publications each month.
`
`Launchedin 1990, IDG Books Worldwideis today the #1 publisher ofbest-selling computerbooksinthe
`United States. We are proudto have received eight awards from the Computer Press Association inrecognition
`of editorial excellenceand three from Computer Currents’ First Annual Readers’ Choice Awards. Ourbest-
`selling...For Dummies® series has more than 30 million copies in print with translations in 30 languages. IDG
`Books Worldwide, through a joint venture with IDG's Hi-Tech Beijing, becamethefirst U.S. publisher to
`publish a computer bookin the People’s Republic of China.In record time, IDG Books Worldwide has become
`the first choice for millions of readers around the world who wantto learn how to better manage their
`businesses.
`Our mission is simple: Every one of our books is designedto bring extra value andskill-building instructions
`to the reader. Our books are written by experts who understand and care about our readers. The knowledge
`base of oureditorialstaff comes from years of experience in publishing, education, and journalism —
`experience we use to produce books for the "90s.In short, we care about books,so weattractthe best people.
`We devote special attention todetailssuch as audience,interior design, use of icons, and illustrations. And
`
`because weuse an efficient process of authoring, editing, and desktop publishing our books electronically,
`we can spend more time ensuring superior contentand spendless time onthe technicalities of makingbooks.
`You can count on ourcommitmentto deliver high-quality books at competitive prices on topicsyouwant
`
`to read about. At IDG Books Worldwide, we continuein the IDG tradition ofdelivering qualityfor morethan:
`
`25 years. You'll find no better book on a subject than one from IDG Books Worldwide. eg
`
`
`!
`\
`
`:
`
`
`;
`
`
`
`
`l
`John Kilcullen
`Presidentand CEO
`
`IDG BooksWorldwi
`
` WINNER
`
`
` WINNER.
`Eleventh Annual
`ee
`=’
`
`‘Eighth Annual
`eeeae
`=
`
`WINNER
`TenthAnnual
`NinthAnnual
`ComputerPress
`ComputerPress
`Awards231994
`Awards31993
`IDG Books Worldwide,Inc,, is a subsidiary of International Data Group, the world’s largest publicher of computer-related information ondthe leading global provider of information services on information techmology. Intemational
`Data Seaypieover 275computer publications in over75 countries. Sixtymillion people readoneormoteInternational DataGroup
`publicationseachmonth. InternationalDataGroup'spublicationsinclude: ARGENTINA:
`Buyer's Guide, Computerworld Argentina, PC World Argentina, AUSTRALIA: Australian Macworld, Australian PC World, Australian
`+ News, Computerworld, IT Casebook, Network World, Publish, Webmaster, AUSTRIA:
`Gm
`it Osterreich, Networks Ausitia, PC Tip Austria; BANGLADESH: PC World Bangladesh, BELARUS: PC World Belarus, BELGIUM:Duta News, BRAZIL: Annudrio de Informatica, Computerworld, Connections, Macworld,
`PC
`Player, PC World, Publish, Reseller News, SeeBULGARIA: Computerworld Bulgaria,NetworkWorld Bulgaria, PC&MacWorld Bulgaria;CANADA: CIOCanada, Clienu/ServerWorld,ComputerWorld Canad,
`InfoWorld Canada,NetworkWorldCanada, WebWorld;
`CHILE: Computerworld Chile, PC World
`Chile;COLOMBIA: ComputerworldColombia, PeWorld Colombia; COSTA RICA: PC WorldCentroAmerica, THE CZECH
`AND SLOVAK REPUBLICS: Computerworld Czechoslovakia, Macworld Czech Republic, PC World Czechoslovakia; DENMARK: Communications World Danmark, Computerworld Danmark, Macworld Danmark, PC World
`Danmark, Techworld Denmark; DOMINICAN REPUBLIC: PC World
`ica Dominicana; ECUADOR: PC World Ecuador; EGYPT: Computerworld Middle East, PC World Middle East; EL SALVADOR: PC ‘World Centro
`America: FINLAND: MikroPC, Tietoverkleo,Tietovitkko; FRANCE: Distrinutique,Hebdo,InfoPC, Le Monde Informatique, Macworld, Reseaux &Telecoms, ‘WebMaster France;GERMANY: aaa Partner, Computerwoche,
`Computerwoche Exira, Computerwoche FOCUS, Global Online, Macwelt, PC Welt, GREECE: Amiga Computing,
`GamePro Greece, Multimedia World: GUATEMALA: PC World Centro America; HONDURAS: PC World Centro
`America;HONGKONG:ComputerworldMongfangToHeHongKong,PublishinAsia,HUNGARY:AECDCD-ROM,‘ComputerworldSeamitastechnika,InternettocalineNasHungary,PC-XMagazinHungary,
`ICELAND: Tolvuheimur PC World Island; INDIA:
`Information Communications World, Information Systems Computerworld, PC World India, Publish in Asia; INDONESIA: In!
`PC World, Komputek Computerworkd,
`Publish in Asia; IRELAND: ComputerSeope, PC Livel; ISRAEL: Macworld israel, People & Computers/Computerworld, ITALY: Computerworld Italia, Macworld Taba, Net
`Talia, PC World balia; JAPAN:
`DTP World,
`Mscworld Japan, Nikkel Personal Computing, OS/2 World Japan, SunWorldJapan, Windows NT World,Windows World Japan, KENYA: PC World East African; KOREA: Hi-Tech Information, Macworld Korea, PC World Korea;
`MACEDONIA: PC World Macedonia; MALAYSIA: Computerworld Malaysia, PC World Malaysia, Publish in Asta; MALTA: PC World Malis; MEXICO: Computerworld Mexico, PC World Mexico; MYANMAR: PC World Myanmar,
`NETHERLANDS:Computer! Total, LAN Internetworking Magazine, LAN World Buyers Guide, Macworld Netherlands, Net, WebWereld; NEW ZEALAND:Absolute Beginners Guide and Plain&Simple Series, Computer Buyer,
`Industry Directory, Computerworld New Zealand, MTB, Network World, PC World New Zealand; NICARAGUA; PC World Centro America, NORWAY:
`werworid Norge, CW Rapport,Dutamagasinet, Financial
`
`guide Norge, Macworld Norge, Multimediaworld Norge, PC World EkspressNonge,PCWorld Nettwerk, PCWorld Norge PC World ProduktGuideNorge;PAKISTAN: Compute
`Pakistan;PANAMA: PCWorld
`
`PEOPLE'S REPUBLIC OF CHINA: China Computer Users, China Computerworld,China InfoWorld, China Telecom World Weekly, Computer & Communication, Electronic Design China, Electranics Today, Electronics
`Software, PC World China, Popular Computer Week, Soltware Weekly, Software World, Telecom World; PERU: Computerworld Peru, PC World Profesional Peru, PC World SoHo Peru, PHILIPPINES: Click!,
`
`|
`ines, PC World Philippines,
`Publish
`in Asia; POLAND: Computerworld Poland, Computerworld
`Special Report Potand, Cyber, Macworld Poland, Networld Poland, PC World Komputer; PORTUGAL:
`wierworld/Corrcio Informatico, DealerWorld Portugal, Mac*inv/PC*In Hill Multimedia World: PUERTO RICO: PC World Puerta Rico; ROMANIA: Computerworld Romania, PC World Romania,
`“omputerworld Russia, Mir PK, Publish, Seti; SINGAPORE: Computerworld
`Singapore, PC World Singapore,Publish in Asia, SLOVENIA: Monitor, SOUTH AFRICA:
`ingSA, Network World
`
`ainicaciones World Espatta, Computerworld Espafta,
`Dealer World Espafia, Macworld
`PC World Espafa; SRI LANKA: Infolink PC World; SWEDEN: CAR
`‘Computer Sweden,
`seid Sweden,it.branschen, Macworld Sweden, MaxiData Sweden, MikroDatom, Natverk & Kommunikation, PC World Sweden, PCaktiv, Windows World
`en; SWITZERLAND:
`
`tip, TAIWAN: ConairTaiwan, Macworld Taiwan, NEWViSION/Publish, PC World Taiwan, WindowsWorld Taiwan; THAILAND:Publish in Asia, Thai Computerwatkd;
`
`hark
`twork World Turkiye, PC World Turkiye; UKRAINE: Computerworld Kiev, Multimedia World Ukraine, PC World Ukraine; UNITED KINGDOM:Aco User UK, Amiga
`
`"7 Macworld,ParentsandComputetsUK, PC Advisor,PCHome,PSXPro,The WEB; UNITED STATES: Cablein the Classroom, C1O Magazine, Computerworld,DOS
`rid, [-Way, Macworld, Network World, PC Games, PC World, Publish, Video Event, THE WEB Magazine, and WebMaster, online webzines: JavaWorld, NetscapeWorld,
`
`,
`VENEZUELA: Computerworld Venezuela, PC World Venezuela, and VIETNAM: PC World Vietnam.
`1096
`
`

`

`
`
`Chapter1: The (Sometimes Painless) BeginnerStuff
`
`9g
`
`Lesson 1-1 Quiz
`
`1. C comes from a programming languagecalled:
`
`ALA.
`
`B. B.
`
`C. Sea.
`
`D. Primordial C.
`
`2. The B language stoodfor:
`
`A. Before C Language.
`
`B. Better than the A Programming Language.
`
`C. Bill & Ted’s Excellent Programming Language.
`
`D. Bell Labs Programming Language.
`
`3. If they came up with another languageafter C, it would probably be called:
`A. A.
`
`B. B.
`
`CAD:
`
`D. All of the above.
`
`4, Cisa:
`
`A. Low-level language.
`
`B. Mid-level language.
`
`C. High-level language.
`
`D.
`
`I thought we weren’t required to knowstuff in the Techy boxes.
`
`Lesson 1-2: How a Meek and Mild
`Text File Becomes a Program
`
`Whenyoucreate a program, you become a programmer.I know,the term is
`newto you.Still, your relatives or people you know mayrefer to you as a “com-
`puter operator” or “wizard” even though your association with the beastis passing
`at best. So hangthetitle of Programmer on yourshingle and swell with pride.
`
`Ahbh....
`
`-C program-
`
`arly 70s. At
`Bell. The next
`
`Dennis
`id you happen
`du Dennis
`lam.” And
`
`
`
`
`evels
`faster than
`Write them.
`
`f it are like
`DOS C com-
`e within a C
`Clanguage
`the almost-
`je of speed
`6 to some
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`ular BASIC
`other lan-
`r anymore,
`all its com-
`fords — or
`‘vowels or
`ng.
`
`
`
`sy to read
`ore slowly
`
`interparts.
`belarger.
`
`
`
`

`

`10 C For Dummies, Volume|
`
`Nowthat youare a programmer, what’s your job? Obviously,it’s to write
`programs. But programs should have a purpose. The purposeis to make the
`computer do something.
`
`The object of programming is to “make it happen.” The C languageis 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 understandsandthen give users whatthey want. Andif 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.
`
`I couldoffer a lot of philosophical advice aboutwriting friendly programs
`and keeping in mindthatthe user isn’t that smart, but, naaah.
`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 developmentcycle
`Hereis how youcreate a C program in nine steps — in what’s known as the
`development cycle:
`
`1. Come upwith idea for program.
`
`2. Use editor to write source code.
`
`3. Compile program by using C compiler.
`4, Weepbitterly over errors (optional).
`5. Link program with linker.
`6. Weepbitterly over errors (optional).
`7. Run program andtest.
`8. Pull out hair over bugs (optional).
`
`9. Start over (required).
`
`your friends that you’re woefully entrenched in the throes of a C language
`
`No need to memorizethis list.It’s like the instructions on a shampoo bottle
`(which arethere, by the way,if you haven't been bored,as I was recently, and
`resorted to reading a shampoo bottleforlack of other reading materials in the
`place where you shower — anddoother 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 aboutthe “developmentcycle” is neat, though. You can complain to
`
`
`
`

`

`
`
`Chapter1: The (Sometimes Painless) BeginnerStuff
`
`1]
`
`y, it’s to write
`Se is to make the
`
`guageis only a too!
`
`Sers into some-
`ey want. Andif you
`1S0 that they don’t
`
`riendly programs
`aaah,
`
`developmentcycle. Watchtheir eyes widen as you impress them with your
`programming knowledge!)
`
`Step1 is the hardest. Therestfall naturally into place.
`Thisreally will become shampoo-easyto youin just a few lessons.
`
`The source code
`
`When youcreate a program,youtell the computer whatto 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, yourfinal line of
`communications is to write the computer a note —a file on disk.
`
`that their needs
`To create the note, you use a program calledafext editor. This is a primitive
`nt, the struggle is
`version of a word processor, minus all the fancy formatting andprinting
`controls. Thetext editor lets you type text — that’s aboutall.
`
`known as the
`
`Using your text editor, you create what’s called a source codefile. The only
`special thing aboutthisfile is that it contains instructions whichtell the
`computer whatto do. And althoughit would be niceto write instructions like
`“Makea funnynoise,” the truth is that you mustwrite instructionsin a tongue
`the computer understands.In this case,the instructionsare written in the C
`language.
`
`Whenyou'vefinished writing the instructions, you save them inafile on disk.
`Havethefirst part of the filename be the nameyouwanttogivethefinal
`program. For example,if you were creating a gamecalled UFO Kill, the source
`codefile should have a first name of UFOKILL.
`
`The secondpart of the filename, the extension, must be C, for the C language.
`This is important! Mosttext files end in TXT or sometimes DOC.Forthe C
`language, yourfiles must endin .C (dot-C), such as UFOKILL.C.
`
`Thesource codefile is a text file on disk. It contains instructions for the
`computer that are written in the C programming language.
`You use a text editor to create the source codefile. Most C compilers
`comewith their own text editors.If yours did not, you can use a third-
`party text editor to do the job. (Some programmersprefer third-party text
`editors.)
`It’s possible to use a word processorto create your source codefiles.
`However,save thefile as a “plain text” or “DOS text” or “ASCII” or
`“unformatted”file. Using a word processorto create a source codefile is
`a lotlike using a 747 to drive to work;it’s a little too much powerfor the
`job at hand.)
`1 complain to
`language
`The source codefile ends with aCas its filename extension.
`
`1poobottle
`recently, and
`aterials in the
`iMpoo instruc-
`be working
`ize them.
`
`ae
`
`
`
`

`

`72
`
` CForDummies,Volume|
`
`Thefirst part of the source codefilename should be the nameof the
`program you wantto create.
`
`Be clever when you name your source code.
`
`The compiler
`
`After the source codeis 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 thatreads the instructions stored in the
`source codefile. The compiler runs through eachinstruction andtranslates 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 secondfile that’s saved on disk. The object
`codefile has the samefirst name as the sourcecodefile, but it ends in .OBJ
`(dot-OBJ). So for that UFO game,it would be UFOKILL.OBJ.
`
`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 codefile 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,
`
`The compiler takes the information in the source codefile and translates it
`into instructions the computer can understand. Theresult is a new file —
`the object file.
`
`Theobject file ends in OBJ. Thefirst part of the object file name is the
`sameas the source codefilename.
`
`Bythe way,all thesefiles are stored in the samedirectory. For information
`on cleaning them up, see Lesson 1-8.
`
`Errors happen. When the compiler sees somethingit 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.
`
`Someofthe C lords call an objectfile’s contents object code. “The object
`file contains object code,yousilly twit,” they spit at you through their
`teeth.
`
`oh STy,
`
`TECH
`
`
`
`
`
`
`

`

`ime of the
`
`inslated into a
`© compiler.
`
`red in the
`1 translates it
`ocessor.
`
`code,it
`1e object
`ds in OBJ
`
`r message on
`-w. Then go
`‘compiler
`ipile the
`
`step is
`
`d translates it
`a new file —
`
`ne is the
`
`r information
`
`lerstand,it
`Although
`son 1-4
`
`he object
`sh their
`
`Chapter1: The (SometimesPainless) BeginnerStuff
`
`13
`
`
`
`
`*Curious, but not required,information on objectfiles
`
`Are objectfilesnecessary? No, notreally.They're
`anintermediate step. From your source code,the
`compiler creates machine-languageinstructions
`that are directly understandable by the micro-
`processor. Itcould atthatpointbuildthefinal program
`file foryou, but an OB,file is created instead.
`
`deal with chapter-size files instead. For large
`programs, it makes sense to break them upinto
`smaller pieces,or modules. Each module is com-
`piled separately, and several OBJfiles are cre-
`ated. It’s the linker’s job to string together,or /ink,
`the separate OBJ files into one EXE (or execut-
`able) file.
`
`The reasonsfor OBJ files come from when you
`At this point in your C programming career, the
`have large programming projects. Inthose cases,
`programsare too smallto warrant creating sepa-
`you're usuallyworking with multiple source code
`rate sourcefiles and multiple OBJfiles. The linker
`files. Why? Primarily to keep the program man-
`ageable. For example, your word processor can
`is still required, however, to convert the single
`hold a 500-page novel as onefile, butit’s easierto
`OBJfile into thefinal programfile.
`
`
`
`
`The linker
`
`Thelinkeris a program,like the compiler. Its job is to create the final program
`file.
`
`Whatthelinker doesis to take the OBJ file created by the compiler and spruce
`it up, producingthefinal program file. Thatfile ends with either a COM or EXE
`extension — whichis how program files are identified under DOS.
`
`Thefirst part of the program filenameis the sameas thefirst part of the source
`codefilename.So if you start with UFOKILL.C, the compiler creates an object
`file, UFOKILL.OBJ, and then thelinker creates the final program file,
`UFOKILL.EXE.
`
`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 combinedinto one.
`Like the compiler, whenthe linker sees somethingit can’t figure out,it
`produces an error message. In that case, you have to decipherthe error
`message and compile the program again (recompile). Lesson 1-4 deals
`with dealing with errors.
`Text editor > Compiler > Linker.
`Source code © Object code © Program.
`
` |
`
`_
`
`|
`i
`
`|
`_
`
`

`

`] 4
`
`C For Dummies, Volume|
`
`Theprogram file ends in EXE, thoughit’s possibleto tell the linker to
`create COMfiles. You can refer to yourlinker’s documentationfor pulling
`off that trick.
`
`Yup,that’s right: From starting with a single source codefile, you end up
`with threefiles on disk: UFOKILL.C, UFOKILL.OBJ, and UFOKILL.EXE. Some
`compilers may anoint your hard drive with even morefiles. Refer to
`Lesson 1-8 for information about managing everything.
`
`Lesson 1-2 Quiz
`
`1. How does a programmertranslate the intentions of the user?
`
`A. Barely.
`
`B. By creating a program thatlets the user accomplish sometask, hope-
`fully the same task the user wants accomplished.
`
`C. Voodoo.
`
`D. Whosaid it was the programmer’sjob to translate the intentions of the
`user?
`
`2. The C developmentcycleis:
`
`A. A stationary device you pedalto workoff uglyfat.
`B. The steps required to create a program byusing the C language.
`C. For older, morelethargic dogs.
`D. How ouroceanswere formed millions of years ago.
`3. Matchthefile on theleft with the thing that createsit on theright:
`
`A. Source codefile
`
`B. Objectfile
`
`C. Program file
`
`1, Text editor
`
`2. Compiler
`
`3. Linker
`
`D. Francophile
`4. France
`4, ihn of the following describesthefiles used to create the STOMPpro-
`
`gram?
`
`A. STOMP.C - STOMP.OBJ - STOMP.EXE
`
`B. STOMP.C - STOMP.EXE
`
`C. STOMP.C - STOMP.COM - STOMP.EXE
`
`D, STOMP - LEFT, STOMP - RIGHT, STOMP, STOMP
`
`

`

`
`
`84
`C For Dummies, Volume|CC —————SSFSFSFFFFFFFFFFssFFeFFseF
`
`
`3. Write a program that accepts input from the keyboard andstores it ina
`variable called name. The program thendisplays the output twice on the
`sameline. For example, the output should look somethinglike this:
`What is your name? Fred
`Fred? My name is Fred too!
`
`4. When I see és in a printf function,I know that:
`A. It must have a correspondingstring variablelater in that same printf
`function.
`
`Ade
`
`Comm
`betwe
`Stick a
`runs,
`
`or Ue
`
`B. Somethingwill be figured by percents.
`C.It’s a variable thingamaboo.
`D. Gone, gone, gone are those carefree days of my youth.
`Hello
`5. Whichofthe followingisaliteral string?
`Hal He
`A. Thething William Shakespeare usedto tie up his boots.
`Nya!
`\
`*/
`B. \"This is a string constant. \"
`C. "No, I'ma literal string!"
`D. &s
`
`It's time for a well-deserved rest. Please go take a break.
`
`
`Lesson 2-3: Remarks, Comments, and
`Suggestions
`An importantpart of programmingis remembering whattheheckit is you're
`doing. I’m not talking about the programmingitself — that’s easy to remember
`and there are books andreferences galore in case you don't.Instead, the thing
`you have to rememberis whatyouare attempting to make a program do at a
`specific spot. This is done by inserting a commentin your source code.
`
`Commentsaren't really necessary for the small programs you're doingin this
`book. They don’t begin to becomenecessary until you write larger programs —
`things on the scopeof Excel or DOS — whereit’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 youlook at the
`source codeagain, your eyes don’t glaze over andthe drool doesn’t pour,
`because the comments remind youof what's going on.
`
`This is
`comme
`
`[*
`
`Thi
`
`The
`
`Yu
`
`The
`afte
`
`A big
`
`Thefolloy
`describec
`
`Name:
`
`/*
`
`MADLIB1.
`Written
`ni
`
`#include
`
`

`

`
`
`——
`
`
`
`Chapter2: Building (and Stumbling) Blocks ofBasic C Programs &5
`
`l and stores it in a
`Adding comments
`utput twice on the
`ning like this:
`Comments in a C program haveastarting point and an ending point. Everything
`between those twopoints is ignored by the compiler, meaning that you can
`stick any text in there — anything — andit doesn’t affect how the program
`runs,
`
`a
`
`
`
`n that same print?
`
`ots.
`
`ind
`
`eck it is you’re
`asy to remember
`astead, the
`rogram do at a
`ce code,
`
`
`This is a fine example of a comment. Whatfollows is another example of a
`comment, but the type that gives this book its reputation:
`
`
`
`Thebeginningof the commentis marked by the slash andasterisk: /*.
`Theend of the commentis marked by the asterisk andslash:*/.
`Yup,they’re different.
`The commentis not a C language statement. You do not need a semicolon
`after the */.
`:
`
`A big, hairy program with comments
`Thefollowing program is MADLIB1.C.It uses the printf and scanffunctions
`described in Lesson 2-2 to create a short yet interesting story.
`
`Name: MADLIB1.C
`
`
`
`
`re doing in this
`‘er programs —
`
`our train of
`
`tick a comment
`
`youlook at the
`
`>sn’t pour,
`
`
`

`

`
`
`86
`
`C For Dummies, Volume|
`
`Fe
`
`
`
`void main()
`{
`
`char adjective[20];
`char food{[20];
`char chore[20]:
`char furniture[20];
`
`/* Get the words to use in the madlib */
`
`/* prompt */
`/* input */
`
`printf("Enter an adjective:");
`scanf("%s",adjective);
`printf("Enter a food:");
`scanf("%s", food);
`printf("Enter a household chore (past tense):");
`scanf("%s",chore);
`printf("Enter an item of furniture:");
`scanf("%s", furniture);
`
`/* Display the output */
`
`printf("\n\nDon't touch that %s %s!\n",adjective, food);
`printf("I just %s the %s!\n",chore, furniture);
`
`
`
`
`Quick hints for entering MADLIB1.C
`(if you still need them)
`The onlything newto youin this program should
`for each. Eachofthestring variablesisfilled by
`be the comments. Each one begins with /* and
`scanf with your keyboard input.
`ends with */. Make sure that you get those
`Each ofthe final printf functions contains two
`right: slash- asterisk beginsthe comment, and an
`#S placeholders. Two string variables in each
`asterisk-slash endsit. They're not boththe same.
`function supply the textfor the %s placeholders.
`MADLIB1.C uses these four string variables:
`The second-to-last print ffunction begins with
`adjective, food, chore, and furniture.
`two newline characters, \n \n. These charac-
`All four of them are created by the char key-
`ters separate the input section, where you enter
`word,and 20 characters of storage are set aside
`thebits of text, from the program's output.
`
`
`
`Typ
`help
`
`Save
`
`Com
`sour
`
`Here
`
`Ent:
`
`Ente
`Ente
`Ente
`
`Con
`not-
`
`The M.
`comme
`
`prograi
`
`/*.
`MADLI
`Writt
`a
`
`Ever po
`comme!
`or such
`*/ all by
`wholep1
`
`

`

` Chapter2: Building (and Stumbling) Blocks of Basic C Programs 8 7
`
`Type the program exactly as written earlier. Use the preceding Cheat sidebar to
`help you throughit (if you need extra help).
`
`Savethefile to disk and name it MADLIB1.C.
`
`Compile thefile into MADLIB1.EXE.If you have anyerrors, double-check the
`source code, reedit, recompile.
`
`Here is a sample of the program’s output:
`
`Enter an adjective:hairy
`Enter a food:waffle
`Enter a household chore (past tense):vacuumed
`Enter an item of furniture:couch
`
`touch that hairy waffle!
`Don't
`I just vacuumed the couch!
`
`This program is long and looks complex, butit doesn’t use any new tricks.
`Everything here you've seen already: the creation ofstring variables with
`char, printf to display text and string variables, and scanf to read the
`keyboard. Yawn.
`Therearefive comments in MADLIB1.C. Make sure that you can find each
`one. Notice that they're not all the same, yet each begins with /* and ends
`with */,
`
`Commentstyles of the nerdy and
`not-quite-yet-nerdy
`
`The MADLIB1.C program contains five comments anduses three different
`commenting styles. Though there are many more ways of commenting your
`programs, these are the most common:
`
`[*
`MADLIB1.C Source Code
`
`Written by Mike Rowsoft
`my
`
`Ever popular is the multiline approach, shownhere.Thefirst line starts the
`commentwith the /* all by itself. Lines followingit are all comments, remarks,
`or such andare ignored by the compiler. Thefinal line ends the commentwith
`*/ all by itself. Remember thatfinal /*; otherwise, the C compiler thinks that your
`whole program is just one big, long comment(possible, but not recommended).
`
`mpt */
`Ut */
`
`, food);
`
`ablesis filled by
`
`
`
`
`1S Contains two
`riables in each
`> placeholders.
`ion begins with
`These charac-
`here you enter
`Output,
`
`

`

`
`
`————————————————ESSESFSFSFSFSMFFFFFFFhsesese
`
`88 C For Dummies, Volume|
`
`/* Get the words to use in the madlib */
`
`This is a single-line comment,not to be confused with a C language statement.
`The commentbegins with /* and ends with */ all on the sameline.This is 100
`percent okey-dokey, and because it’s not a statement, you don’t need a semicolon.
`
`printf("Enter an adjective:");
`
`/* prompt */
`
`Finally, there is the “end ofline” comment. After the preceding printf statement plus
`a few taps of the Tab key, the /* starts a comment,and */ endsit on the sameline.
`
`Why are comments necessary?
`Comments aren’t necessary for the C compiler.It ignores them.Instead,
`commentsarefor you, the programmer. Theyoffer bits of advice, suggestions
`for what you'retrying to do,or hints on how the program works. You can put
`anything in the comments,though the moreuseful the information,the betterit
`helps youlater on.
`
`MostC programsbegin with a few lines of comments.All my C programs start
`with information suchas the following:
`
`/* MINICOM.C
`Dan Gookin, 9/26/94 @ 2:45 a.m.
`My latest attempt
`to write a communications
`program in C. Wish me luck.
`ey
`
`Theselines tell me what the program is about a

This document is available on Docket Alarm but you must sign up to view it.


Or .

Accessing this document will incur an additional charge of $.

After purchase, you can access this document again without charge.

Accept $ Charge
throbber

Still Working On It

This document is taking longer than usual to download. This can happen if we need to contact the court directly to obtain the document and their servers are running slowly.

Give it another minute or two to complete, and then try the refresh button.

throbber

A few More Minutes ... Still Working

It can take up to 5 minutes for us to download a document if the court servers are running slowly.

Thank you for your continued patience.

This document could not be displayed.

We could not find this document within its docket. Please go back to the docket page and check the link. If that does not work, go back to the docket and refresh it to pull the newest information.

Your account does not support viewing this document.

You need a Paid Account to view this document. Click here to change your account type.

Your account does not support viewing this document.

Set your membership status to view this document.

With a Docket Alarm membership, you'll get a whole lot more, including:

  • Up-to-date information for this case.
  • Email alerts whenever there is an update.
  • Full text search for other cases.
  • Get email alerts whenever a new case matches your search.

Become a Member

One Moment Please

The filing “” is large (MB) and is being downloaded.

Please refresh this page in a few minutes to see if the filing has been downloaded. The filing will also be emailed to you when the download completes.

Your document is on its way!

If you do not receive the document in five minutes, contact support at support@docketalarm.com.

Sealed Document

We are unable to display this document, it may be under a court ordered seal.

If you have proper credentials to access the file, you may proceed directly to the court's system using your government issued username and password.


Access Government Site

We are redirecting you
to a mobile optimized page.





Document Unreadable or Corrupt

Refresh this Document
Go to the Docket

We are unable to display this document.

Refresh this Document
Go to the Docket