Introduction To Programming C Chopra Rajiv download
Introduction To Programming C Chopra Rajiv download
download
https://ebookbell.com/product/introduction-to-programming-c-
chopra-rajiv-56597050
https://ebookbell.com/product/introduction-to-programming-with-c-3rd-
international-edition-3rd-y-daniel-liang-55234740
https://ebookbell.com/product/introduction-to-programming-with-c-for-
engineers-1st-edition-boguslaw-cyganek-22898364
https://ebookbell.com/product/introduction-to-programming-in-c-
language-c-programming-best-c-programming-language-book-for-beginners-
khachane-23917738
https://ebookbell.com/product/introduction-to-programming-with-c-1st-
edition-nhce-23436930
Introduction To Programming With C For Engineers Cyganek Boguslaw
Cyganek
https://ebookbell.com/product/introduction-to-programming-with-c-for-
engineers-cyganek-boguslaw-cyganek-23549354
https://ebookbell.com/product/introduction-to-programming-in-c-
language-c-programming-best-c-programming-language-book-for-beginners-
khachane-23917736
https://ebookbell.com/product/introduction-to-programming-languages-
programming-in-c-c-scheme-prolog-c-and-soa-fifth-edition-
yinong-21889502
https://ebookbell.com/product/an-introduction-to-programming-
with-c-6th-edition-6th-diane-zak-2427428
https://ebookbell.com/product/an-introduction-to-programming-
with-c-8th-edition-diane-zak-38548024
C
Programming
LICENSE, DISCLAIMER OF LIABILITY, AND LIMITED WARRANTY
By purchasing or using this book (the “Work”), you agree that this license
grants permission to use the contents contained herein, but does not give you
the right of ownership to any of the textual content in the book or ownership
to any of the information or products contained in it. This license does not
permit uploading of the Work onto the Internet or on a network (of any kind)
without the written consent of the Publisher. Duplication or dissemination
of any text, code, simulations, images, etc. contained herein is limited to and
subject to licensing terms for the respective products, and permission must
be obtained from the Publisher or the owner of the content, etc., in order to
reproduce or network any portion of the textual material (in any media) that is
contained in the Work.
The author, developers, and the publisher of any accompanying content, and
anyone involved in the composition, production, and manufacturing of this
work will not be liable for damages of any kind arising out of the use of (or the
inability to use) the algorithms, source code, computer programs, or textual
material contained in this publication. This includes, but is not limited to, loss
of revenue or profit, or other incidental, physical, or consequential damages
arising out of the use of this Work.
The sole remedy in the event of a claim of any kind is expressly limited to
replacement of the book and only at the discretion of the Publisher. The use
of “implied warranty” and certain “exclusions” vary from state to state, and
might not apply to the purchaser of this product.
C
Programming
A Self-Teaching Introduction
By
RAJIV CHOPRA, PhD
This publication, portions of it, or any accompanying software may not be reproduced in
any way, stored in a retrieval system of any type, or transmitted by any means, media,
electronic display or mechanical display, including, but not limited to, photocopy, record-
ing, Internet postings, or scanning, without prior permission in writing from the publisher.
The publisher recognizes and respects all marks used by companies, manufacturers, and
developers as a means to distinguish their products. All brand names and product names
mentioned in this book are trademarks or service marks of their respective companies. Any
omission or misuse (of any kind) of service marks or trademarks, etc. is not an attempt to
infringe on the property of others.
Our titles are available for adoption, license, or bulk purchase by institutions, corporations,
etc. For additional information, please contact the Customer Service Dept. at 800-232-
0223(toll free).
All of our titles are available in digital format at authorcloudware.com and other digital
vendors. The sole obligation of Mercury Learning and Information to the purchaser is to
replace the book, based on defective materials or faulty workmanship, but not based on the
operation or functionality of the product.
Contents
Preface viii
Acknowledgments x
Chapter 1: C Overview 1
1.0 Introduction 1
1.1 The Concept of Algorithms and Pseudocodes 2
1.2 Flowcharts 8
1.3 Compiler Overview 15
1.4 Assembler, Linker, and Loader 19
1.5 Structure of a Simple “Hello World” Program in C 22
1.6 Overview of the Compilation and Execution
Process in an Integrated Development Environment
(preferably CodeBlock) 30
Summary 32
Exercises 32
Appendices 341
B: Keywords in C 343
References 347
Index 349
Preface
The right temperament required for research originates from the right expo-
sure and environment that a student receives during study. And good books
help in this direction.
Programming is an art. You have to learn this art, as only then will you learn
how to write good programs.
This book is an outcome of lecture notes prepared during my long years of
teaching Introduction to Programming (C), augmented by consulting a large
number of books available on the subject. I thank my students, colleagues, and
teachers, as well as all the authors who have helped in shaping my approach to
this knowledge.
Acknowledgments
A dream is visualized by a pair of eyes; however, many pairs of hands join to-
gether and work hard toward its realization. This book has been a similar en-
terprise.
I next thank my college staff, director, and HOD for their contributions to
this book on the C programming language.
I would also like to thank the entire staff of Mercury Learning for bringing
the book to a new market.
Finally, I would like to thank my wife, Mrs. Shakti, my twin kids, Arjessh
and Arshitha Chopra, as well as my parents who cooperated with me in all terms
in order to write this book.
Dr. Rajiv Chopra
CHAPTER
1
C Overview
1.0 INTRODUCTION
T
he C programming language was developed by Dennis Ritchie at AT&T
Bell Laboratories in the early 1970s. Soon after, Bell Laboratories devel-
oped a new operating system, called UNIX. About 90% of the code for
the Unix operating system (OS) was exclusively in C. As C gained popularity,
more and more vendors joined the race and developed their own compilers.
This was necessary because until the late 1970s, only Bell Laboratories had a C
compiler.
In the early 1980s, realizing the need to standardize the C language, the
American Standards Institute (ANSI), an organization that handles such mat-
ters, began the task. In 1990, the first official ANSI standard definition of C was
published. Soon C became omnipresent and thus there was a need of further
standardization. The International Standards Organization (ISO) adopted a
standard called ISO/IEC 9899:1990. After 1990, many additional changes were
made in the C language. In 1993, an ANSI C committee (known as X3J11), was
formed to standardize C. The most recent standard was adopted in 1999. It is
known as ANSI C99 or ISO/IEC 9899:1999. Since then, ANSI C has been im-
plemented on a wide variety of computers, including IBM-compatible personal
computers (PCs), mainframes, minicomputers, and workstations.
C is a higher-level language that nevertheless allows the programmer to deal
with hardware at a much lower level. Please note that although C is a general-
purpose programming language, it was designed with systems program-
ming applications in mind. So it provides a lot of power and flexibility.
2 • C Programming
This chapter discusses some basic terminology related to C and also ex-
plains the process of compiling a program written in the C language.
if (a > b)
Step 3: do if (a > c)
Step 4: then Print ‘a’ and go to step-12.
Step 5: else
Step 6: Print ‘c’ and go to step-12.
Step 7: else
Step 8: do if (b > c)
Step 9: then Print ‘b’ and go to step-12.
Step 10: else
Step 11: Print ‘c’ and go to step-12.
Step 12: Stop
In all of the preceding dry runs, the expected output equals the
NOTE observed output.
Step 5: else
Step 6: do if (x = y && y! =z) || (x = z && z!=y) || (y=z &&x!=z)
Step 7: then do if (x = sqrt( z2 /2) || (x = sqrt(y2 /2) || (y = sqrt(x2 /2))
Step 8: Print: ‘Right Angled Isosceles Triangle’ and go to step 17.
Step 9: else
Step 10: Print: ‘Isosceles Triangle’ and go to step 17.
Step 11: else
Step 12: do if (x = sqrt(z2 + y2 )) || (y = sqrt(z2 + x2 )) || (x = sqrt(x2 + y2 ))
Step 13: then Print: ‘Right Angled Scalene Triangle’ and go to step 17.
Step 14: else Print: ‘Scalene Triangle’ and go to step 17.
Step 15: else
Step 16: Print: ‘Not a triangle’ and go to step 17.
Step 17: Stop.
Process:
Is (x + y > z) && (y + z > x) && (x + z > y)?
True
Is x = y && y = z?
False
Is (x =y && y!=z) || (x=z && z!=y) ||(y=z && z!=x)?
True
Is (32 + 42 = 52) → True
Observed Output: Right Angled Scalene Triangle
Dry Run 3:
Input: x = 6
y = 6
z = 6
Expected output: Equilateral Triangle
Process:
Is (6 + 6 > 6) ? → True
Is (6 = 6 = 6) → True
Observed Output: Equilateral Triangle
In all of the preceding dry runs, it is seen that the expected output
NOTE equals the observed output.
1.2 FLOWCHARTS
Amount due
Start
Read
quantity,
price
Multiply quantity
by price
Write
amount bill
Stop
1. Each algorithm should have only one entry point and one exit point.
2. A null statement is shown by a flow line; there is no symbol for null.
Variable ← Expression
Start/Stop
Decisions
C Connector
Flow of control
Module call
start
Input
a,b,c
Y
Is a>b? Is a>c? Print a
N N
Y
Is b>c ? Print c
Print c Print b
Stop
C Overview • 13
Start
Input
a, b, c
Print 'Not
a
Is a=0?
quadratic
equation'
D = b2 – 4ac
Is D>0
OR roots=(-b+ sqrt(D))/2a
D<0?
ROOTS=-b /2a
Print
ROOTS
STOP
Example 6: It is desired to add n numbers. Write the following for this
problem:
Hint: (a) Plain English: First, read n numbers to be added. Initialize a re-
sultant value to 0. Then add these numbers to this resultant value one by one.
When all the numbers have been added, display the result.
(b) Structured English:
Step 1: Start
Step 2: Initialize sum and number of elements to add to 0.
Step 3: Read the number of elements to add—that is, read n.
Step 4: Read a number to be added and let it be a.
Step 5: s=s+a and i=i+1
Step 6: If i<n, go to step 4, else go to step 7.
Step 7: Display (output) the value of sum.
Step 8: Stop.
(c) Pseudocode:
Algo_ add(a, n)
{
s:= 0.0;
for i:=1 to n do
s:= s + a [i]; S + a [i];
return s;
}
(d) C Code:
int add(int a[ ] , int n)
{
int i, s=0;
for(i=0; i <n ; i++)
s=s + a[i];
return s;
}
C Overview • 15
Start
Source
program
Edit
(file.c)
Compile
and
assemble
yes Object
Errors program
? (file.o)
no
Link
Libraries
and other Execute Executable
object object
program (a.out)
Results
no OK?
yes
Finish
Figure 1.3 Basic Steps for Entering, Compiling, and Executing C Programs
Explanation: The program that is to be compiled is first typed and saved into
a file. C programs are saved with a .c extension. Thus, program1.c might be a
valid filename for a C program. A C program is typed, saved, and edited in a
text editor. For example, vi is a popular text editor used on Unix systems. The
program that is entered into the file is known as the source program
because it represents the original form of the program expressed in the
C language. After the source program is entered into a file, you can then pro-
ceed to have it compiled. The compilation process is initiated by typing a special
command on the system. When this command is entered, the name of the file
that contains the source program must also be specified. For example, on Unix
systems, the command to initiate program compilation is called cc.
But please remember that if you are using the popular GNU C compiler,
the command you use is gcc. So typing the line
gcc program1.c
has the effect of initiating the compilation process with the source program
contained in program1.c.
C Overview • 17
In the first step of the compilation process, the compiler examines each
of the program statements contained in the source program and checks to en-
sure that each conforms to the syntax and semantics (meaning) of the language.
Practically speaking, the C compiler normally makes a prepass of the program
looking for special statements. This is also known as a preprocessing phase. If
any mistakes are discovered by the compiler during this phase, they are report-
ed to the user and the compilation process ends right there. Then the errors
have to be corrected in the source program using an editor and the compilation
process must be restarted. Typical errors reported during this phase of compi-
lation might be due to an expression that has unbalanced parentheses (syntax
error) or due to the use of a variable that is not defined (i.e., semantic error).
When all the syntactic and semantic errors have been removed from the
program, the compiler then proceeds to take each statement of the program
and translate it into lower form. This means that each statement is trans-
lated by the compiler into the equivalent statement or statements in
assembly language needed to perform the task.
After the program has been translated into an equivalent assembly language
program, the next step in the compilation process is to translate the assembly
language statements into actual machine instructions. This step might or might
not involve the execution of a separate program known as an assembler. On
most systems, the assembler is executed automatically as part of the compila-
tion process. The assembler takes each assembly language statement and con-
verts it into a binary format known as object code which is then written into
another file on the system. This file typically has the same name as the source
file under Unix, with the last letter as “o” (for object) instead of a “c”. In Win-
dows, the suffix letters “obj” typically replace the “c” in the filename.
After the program has been translated into object code, it is ready to be
linked. This process is once again performed automatically whenever the cc
or gcc command is issued under Unix. Also understand that the purpose
of the linking phase is to get the program into a final form for execu-
tion on the computer. If the program uses other programs that were previ-
ously processed by the compiler, then during this phase the programs are linked
together. Programs that are used from the system’s program library are also
searched and linked together with the object program during this phase. The
process of compiling and linking a program is known as building. The
final linked file, which is in an executable object code format, is stored in
another file on the system, ready to be run or executed.
Under Unix, this file is called a.out (by default).
18 • C Programming
Under Windows, the executable file usually has the same name as the
source file, with the c extension replaced by an exe extension.
The command a.out is used to execute the program. This command will
load the program called a.out into the computer’s memory and initiate its ex-
ecution. When the program is executed, each of the statements of the program
is sequentially executed in turn. If the program requests any data from the
user (called input), the program temporarily suspends its execution so that the
input can be entered. Or the program might simply wait for an event, such
as a mouse being clicked, to occur. Results that are displayed by the program
(called outputs) appear in a window (also called console). Or the output might
be directly written to a file on the system.
If the program works correctly, there is no problem, but this does not of-
ten happen on the first attempt. If the program does not produce the desired
results, it is necessary to go back and reanalyze the program’s logic. This is
known as the debugging phase, during which an attempt is made to remove
all known problems or bugs from the program. Doing this requires making
changes to the original source program. Please note that in such a case, the
entire process of compiling, linking, and executing the program must
be repeated until the desired results are obtained. Also note that in
general, gcc follows the following processing steps:
Step 1: Preprocessing (invokes cpp)
Step 2: Compilation
Step 3: Assembly (invoke as)
Step 4: Linking (invokes ld).
This can also be shown graphically, as in Figures 1.4 and 1.5.
gcc
Myprog.c Myprog.s
8086 m/c code
Assembler as
Myprog.s Myprog.o
(x86 m/c code)
gcc
Myprog.c Myprog.o
8086 m/c code
Linker ld
Myprog.o Myprog
(x86 m/c code)
Each computer has its own machine language that is made of streams of
0s and 1s. This is so because computers are made up of switches, transistors,
and other electronic devices that can be either in 1 (logic high) or 0 (logic low)
states. These are also named as 0 (off state) and 1 (on state).
into machine language. The program that translates symbolic code into
machine language is known as an assembler.
Then in the 1960s came the introduction of high-level languages that re-
lieved the programmer of the tedious task of writing programs in assembly
language. Both symbolic and higher-level languages share one thing in com-
mon—both must be converted into machine language. And this process of
converting them is known as compilation.
For example, the first high-level language was FORTRAN (FORmula
TRANslation). It was created by John Backus and an IBM team in 1957. C is
also a high-level language used for developing system software and new appli-
cations.
Often a program is so large that it is convenient to break it down into small-
er units. Each of these units is stored in a separate file. After these separate
program files are compiled, they must somehow be linked together to form a
single program. This linking is usually accomplished by a program called
a linkage editor, which is often run automatically when a program is
compiled. This linker assembles all of the functions (both user-defined
as well as system functions) into a final executable program.
Once a program has been linked, it is ready for execution. To execute a
program, we use an operating system command like the run command. This
command will load the program into primary memory and execute it. And get-
ting the program into memory is the function of an operating system
program known as the loader. It locates the executable program and
reads it into memory. When everything is loaded, the program takes
control and it begins execution.
We are in a position to solve some examples now.
Example 1: Compare a compiler and an interpreter.
Solution 1: The following chart compares a compiler and an interpreter:
Compiler Interpreter
1. Converts the whole program into 1. Converts the program into ma-
machine code and then executes chine code one step at a time and
the entire program. then runs only
that step.
2. Lists all errors after compilation. 2. Immediately displays any error in
any line of the program after the
translation of that line.
C Overview • 21
Preprocessor Directives
Global declarations
Main function
This program has only one preprocessor directive. There are no global
declarations and no local definitions. It simply displays “Hello World!” on the
screen. Then there are two statements, one to print the message and the other
to stop the program.
Let us learn about these parts now.
I. Preprocessor Directive/Command
As discussed earlier, a preprocessor is a part of the C compilation process that
recognizes special statements that might be interspread throughout a C pro-
gram. It actually analyzes these statements before analysis of the C program
starts. The preprocessor is a section of the compiler which looks over the C
program before it is compiled.
Working of Preprocessor
When you issue the command to compile a C program, the program is run au-
tomatically through the preprocessor. The preprocessor is a program that modi-
fies the C source program according to the directives supplied in the program.
An original source program is usually stored in a file. The preprocessor does not
modify this program file but creates a new file that contains the processed ver-
sion of the program. This new file is then submitted to the compiler.
When we compile this program, the compiler shows the number of lines
compiled to be greater than 6. This is because during the preprocessing stage,
the include preprocessor directive (line 1) searches the file stdio.h in the pre-
scribed list of directories and if the header file is found, the include directive
is replaced by the entire content of the header file. If the included header file
contains another include directive, it will also be processed. This processing
is carried out recursively till either no include directive remains or till
the maximum translation limit is achieved (ISO specifies a maximum of
15 nested levels of include files). Thus, one line of source code gets replaced
by multiple lines of the header file. During the compilation stage, these added
lines will also be compiled. Thus, the compiler shows the number of lines to be
greater than 6.
13. Header files also provide consistency among several program files.
Often a program is large and thus it is possible to break it into smaller
units, each of which is stored in a separate file. After these separate
program files are compiled, they must somehow be linked together to
form a single program. This linking is usually done by a program called
the linkage editor (which is run automatically when a program is
compiled).
14. A header file can contain other #include directives. Please note that
it cannot include itself because this would result in an infinite
recursion. Also note that it cannot include another file that
includes the first file as this would also result in an infinite
recursion.
15. Header files can contain any text at all. They may also contain C code
to define structure templates, global variables, or function definitions.
However, header files usually do not contain function definitions, as it is
more efficient to store these in the function libraries set up by the user.
But global variables are sometimes included.
16. If stdio.h is included in the program, the macro versions (to be discussed
later) are used. On the other hand, if the programmer wishes to use the
function versions they can be undefined after the #include<stdio.h>
directive.
17. A preprocessor directive is terminated by the end of the line it oc-
cupies but if necessary it can be continued onto one or more lines by
ending all but the last line with backslashes.
After identifying the main( ) to the system, we must now specify what this
routine must do. And this is done by enclosing all program statements of the
routine within a pair of curly braces (line 3). Also note that all program
statements included between the braces are taken as part of the main
routine by the system. In the Hello World! program, we have only two such
statements. The first statement tells that a routine named printf is to be
invoked or called. The string of characters “hello world! \n” is the pa-
rameter or argument to be passed to the printf routine.
Just remember that the printf routine is a function in the C library. It simply
prints or displays its arguments on your screen in between double quotation
marks. Also note that a blank space in a string counts as a character.
Also seen in line 4 are two special characters—the backslash (\) and the
letter n—that are together known as the newline character. This newline
character tells the system to do precisely what its name implies—that
is, go to a new line (next line).
This exit status can be tested by other programs like the UNIX
NOTE shell to see whether the program ran successfully.
The end of the program is marked off by a closing brace. Remember the
following programming tips:
1. The number of opening braces and closing braces must be the same.
2. These braces line up with the letter ‘m’ of the main( ).
28 • C Programming
All of the tools like text editor, preprocessor, compiler, and linker that are
required for developing programs are integrated into one package known as an
IDE.
Codeblocks is an open source, cross-platform IDE. A global variable or a
function defined in one source file can be used in another source file in a mul-
tifile program. Let us see how.
Consider a program that consists of two source files, t1.c and t2.c. The
source file t2.c contains the definition of a variable var1 and a function fun1.
These definitions are used in another source file t1.c of the program. Because
the global variables and the function have external linkage, this usage is al-
lowed. And this can be done with CodeBlock as follows:
Say, file t1.c has the following code:
#include<stdio.h>
main( )
{
C Overview • 31
[Hint: Preprocessor directives are the lines to be executed before the ac-
tual compilation of the code starts. And wherever in the program code the
macros are called, the code of that macro is inserted. On the other hand,
in a function call, the body of the function is executed at runtime. And
wherever in a code the functions are called, the execution of the program
jumps to the body of the function. Code is not copied as in the case of
preprocessor directives.]
Q7. Name some popular C language IDEs.
[Hint: There are various IDEs on the market today targeted toward differ-
ent operating systems. For example, Turbo C and Turbo C++ are popular
compilers that work under MS-DOS, Visual Studio and Visual Studio Ex-
press Edition are compilers that work under Windows, whereas the gcc
compiler works under Linux. Please note here that the Turbo C, Turbo
C++, and gcc compilers can also be installed on machines running Win-
dows. Both the Visual Studio Express Edition and gcc compilers are free
of cost and can be downloaded easily.]
Summary
In this chapter, we have studied what an algorithm is. We have defined terms
like flowcharts, pseudocode, and structured English. Also we have seen how a
C program is compiled and run. The roles of assemblers, linkers, and loaders
have also been examined. We have specifically focused on the gcc compiler.
The chapter also shows the basic structure of any C program. It also discusses
the IDEs that are used to compile and run C programs like CodeBlocks.
Exercises
Q1. What is a C preprocessor? Explain each of them.
Q2. How do you debug a C program? Discuss the purpose of preprocessor
directive statements and macros as used in the C language?
Q3. What is an interactive debugger?
Q4. Distinguish between the following with examples:
(a) Syntactic errors and semantic errors
(b) Runtime errors and logical errors
(c) Debugging and testing
Q5. What is the scope of a preprocessor directive within a program file?
C Overview • 33
(c) How would you modify the above commands to link a library called
process2 stored in the home directory?
(d) Some header files need to be read and have been found in a header
subdirectory of your home directory and also in the current work-
ing directory. How would you modify the compiler commands to ac-
count for this?
Q21. Suppose you have a C program composed of several separate files and
they include one another as shown in the following chart:
File Name Include Files
main.c stdio.h, process1.h
input.c stdio.h, list.h
output.c stdio.h
process1.c stdio.h, process1.h
process2.c stdio.h, list.h
2
Programming Using C
2.0 INTRODUCTION
C
is a general purpose, block-structured, procedural, case-
sensitive, freeflow, portable, powerful high-level programming
language. This language is so powerful that an operating system like
UNIX is itself coded in C. It is said that programming languages are born,
age, and eventually die but the C programming language has only matured
from the time it was born. It has the same relevance today as it had when it
was developed by Dennis Ritchie at Bell Telephone Laboratories in 1972. The
importance of the language can be easily fathomed from the fact that C is a
prerequisite in any software industry today.
modifies the C source program according to the directives supplied in the pro-
gram. An original source program is usually stored in a file. The preprocessor
does not modify this program file but creates a new file that contains the pro-
cessed version of the program. This new file is then submitted to the compiler.
When we compile this program, the compiler shows the number of lines
compiled to be greater than 6. This is because during the preprocessing stage,
the include preprocessor directive searches the file iostream.h in the pre-
scribed list of directories and if the header file is found, the include directive
is replaced by the entire content of the header file. If the included header file
contains another include directive, it will also be processed. This processing
is carried out recursively till either no include directive remains or till
the maximum translation limit is achieved (ISO specifies a maximum of
15 nested levels of include files). Thus, one line of source code gets replaced
by multiple lines of the header file. During the compilation stage, these added
lines will also be compiled. Thus, the compiler shows the number of lines to be
greater than 6.
8. It tells the preprocessor that you want the library file in angular
brackets (< >) to be included in your program. The name of this
header file is iostream.h. It stands for “Standard input/output header
stream file.”
9. The angular brackets tell the preprocessor to search for the file in
one or more standard directories. These directories contain header files
that are provided by the system and those commonly used by several
programmers (if the computer is a multiple-user machine).
10. Sometimes the brackets are replaced with double quotation marks as in
the following:
#include “iostream.h”
In this case the preprocessor will first look in the program-
mer’s own directory or the same one that contains the program
file. If it is NOT found there, then the standard directories are
searched.
Definition Section
In this section, we define a variable with some value in it. This is also known as a
special constant section. Here, a define statement is used. The general syntax
of a symbolic preprocessor or symbolic compiler directive can be defined using
the following #define statement:
#define name value
For example,
#define PI 3.1417
This initializes a variable PI with a value of 3.1417. But please remember
the following points regarding a #define preprocessor directive:
CHARACTERS
Mother.
Toinette, girl of twelve or fourteen.
Marie, girl of eleven.
Jeannette, little girl of five or six.
Pierre }
Boys of ten or eleven.
Marc }
The Elves:
Hollyberry }
Mistletoe }
Little boys of five or six.
Evergreen }
Icicle }
Hollyberry
TOINETTE AND THE ELVES
From the story by Susan Coolidge, St. Nicholas for January, 1876.
ACT I
Time: Christmas Eve.
Scene: The kitchen of a peasant cottage. Open fireplace[7] (R.) with
large pot, hung from a crane, or standing directly upon the logs. On
the shelf above, small bowls and spoons. Beside fireplace, a narrow
exit leading to Toinette's room: opposite, door to other rooms.
Outside door, R. Back. L. window. Down stage L. a low table with
small chairs, where the children sit for their supper, used later by the
Elves. Before the fire, a large old-fashioned wooden rocker.
Mother bends over sewing, near window, from time to time glancing
at Toinette, who sits dreamily gazing into the fire.
ACT II
Time: One year later. Christmas Eve.
Scene: Curtain rises showing Toinette and Marie seated, sewing;
Jeannette sits upon the floor, leaning against Toinette's knee; Marc
leans over the back of her chair; Pierre sits in the big chair rocking
and looking on. All are singing a Christmas carol. Enter Mother,
pausing a moment in doorway to watch and smile at the group.
CURTAIN
CHARACTERS
Father Wright.
Mother Wright.
Phil }
Daisy }
Charlie } The little Wrights.
Tom }
Dot }
Sarah, the nurse.
Santa Claus.
TOM’S PLAN
ACT I
Time: Christmas Eve.
Scene: Nursery or sitting-room, children sitting about, each working
upon a Christmas gift. Nurse at one side with her work-basket. All
singing a Christmas carol.[8]
ACT II
Time: Christmas morning.
Scene: Sitting-room with open fire [back Center] in fireplace through
which Santa Claus may enter. Father and Mother sitting by fire, Father
with paper, Mother sewing. Phil and Charlie in one corner [R. Front],
reading together. Daisy and Dot [L. Front] with dolls.
Daisy. And I caught Mamma! I hid behind the door, and jumped out
and shouted "Merry Christmas!" before she saw me at all.
Dot [leaning towards Daisy]. Daisy, let's say it to Santa Claus.
Daisy. Oh, do you suppose he would like it?
Dot. Why not?
Daisy. Yes, I guess he would. Dear Santa Claus, nobody ever thinks
of saying "Merry Christmas" to him.
Dot. Poor man! Well, Daisy, his little boys and girls might say it to
him.
Daisy. Oh, Dot! He hasn't any little boys and girls to say it. Don't you
know he's an old man, oh, hundreds of years old? And if he ever did
have any little boys and girls, they're all grown up by this time.
Dot. Maybe he's got some grandchildren.
Daisy. No, I don't believe he has, for then why do they let him do all
the work? Nobody ever fills stockings but Santa Claus.
Dot. Poor Santa Claus! He must get very tired.
Daisy. I wonder ... I wonder who keeps house for Santa Claus?
Dot. Maybe nobody does.
Daisy. Oh, yes! He must have somebody to make his fires, and cook
his meals, and darn his socks.
Dot. Why, he doesn't wear socks. Don't you know, he's all dressed in
fur in the pictures. But perhaps fur wears out and has to be mended.
I'd like to help her do it.
Daisy. Perhaps she's a real cross, ugly woman, and scolds him when
he stays out too long filling stockings, and doesn't give him enough
sugar in his tea, and never lets him have but one cup!
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
ebookbell.com