Character Sketches

Now let's look at something a little more decorative. The plan is to create a program that enables you to draw rough, filled-in figures by using characters. Each line of output consists of an unbroken row of characters. You choose the character and the starting and stopping positions for printing the character in the row. The program, shown in Listing 8.8, keeps reading your choices until it finds EOF. This program illustrates several programming techniques, which, of course, we'll discuss soon.

Listing 8.8 The sketcher.c program.
 /* sketcher.c -- this program makes solid figures */ #include <stdio.h> #include <ctype.h> #define TRUE 1 #define FALSE 0 #define MAXLENGTH 80 int badlimits(int begin, int end, int limit); void ...

Get C Primer Plus®, Third Edition 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.