Using the Example Programs

QuickC for Windows online help includes all the significant example programs in Part 1 of this book (it doesn't include code fragments and some very short programs). This feature allows you to load, run, and experiment with example programs as you read. Every program that is in online help begins with a line in this general form:

/* POINTER.C: Demonstrate pointer basics. */

The line contains the program's name and a brief description of what it does. The program containing the above line is listed as POINTER.C in online help.

You must use the Graphical Development Environment to load an example. To load the program, select C Lang from the Help Contents, then select Examples. Find the program you want, then copy it to the editor using the Copy and Paste functions.

After you copy a sample program to the editor, you can treat it as you would any C source program. You can compile or edit the program, save it on disk, and so on.

The samples in the first section of this book are all character-based—they use no Windows interface features. You should build them as QuickWin programs. (See the Development Environment Guide for information on building programs.) A QuickWin program displays a window and provides basic screen input and output without you having to know the Windows programming details. This is helpful as you are learning C. (See Appendix C, “QuickWin Programs,” for more information.)

All the examples available in online help compile without errors at Warning Level 3, in which QuickC does the most stringent error-checking. At this Warning Level, some examples will generate the following harmless warnings:

C4103: 'main' : function definition used as prototype

C4035: 'main' : no return value

C4051: data conversion

You can eliminate these warnings by compiling at a lower Warning Level.

All the Windows examples in the second section of the book are copied to your hard drive when you install QuickC. Their default location is \qcwin\source. All the project files, resource files, and module definition files are decompressed and copied. During installation, you must indicate you want these files installed.