100% found this document useful (1 vote)
19 views

Programming in ANSI C 6th Edition E. Balagurusamy download

The document provides information about the book 'Programming in ANSI C, 6th Edition' by E. Balagurusamy, including details on its content, author, and publisher. It outlines the structure of the book, covering various topics related to C programming, such as data types, operators, input/output operations, and memory management. Additionally, it includes links to other related programming books available for download.

Uploaded by

yilekbakeysg
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
19 views

Programming in ANSI C 6th Edition E. Balagurusamy download

The document provides information about the book 'Programming in ANSI C, 6th Edition' by E. Balagurusamy, including details on its content, author, and publisher. It outlines the structure of the book, covering various topics related to C programming, such as data types, operators, input/output operations, and memory management. Additionally, it includes links to other related programming books available for download.

Uploaded by

yilekbakeysg
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 81

Programming in ANSI C 6th Edition E.

Balagurusamy download

https://ebookgate.com/product/programming-in-ansi-c-6th-edition-
e-balagurusamy/

Get Instant Ebook Downloads – Browse at https://ebookgate.com


Get Your Digital Files Instantly: PDF, ePub, MOBI and More
Quick Digital Downloads: PDF, ePub, MOBI and Other Formats

C Programming Data Structures 4th Edition E.


Balagurusamy

https://ebookgate.com/product/c-programming-data-structures-4th-
edition-e-balagurusamy/

Computer Programming 1st Edition E. Balagurusamy

https://ebookgate.com/product/computer-programming-1st-edition-e-
balagurusamy/

Programming with ANSI C 2nd ed Edition Trivedi

https://ebookgate.com/product/programming-with-ansi-c-2nd-ed-
edition-trivedi/

An Introduction to Programming with C 6th Edition Diane


Zak

https://ebookgate.com/product/an-introduction-to-programming-
with-c-6th-edition-diane-zak/
Beginning ANSI C The Complete Language 3rd Edition Ivor
Horton

https://ebookgate.com/product/beginning-ansi-c-the-complete-
language-3rd-edition-ivor-horton/

C Programming Program Design Including Data Structures


6th Edition D. S. Malik

https://ebookgate.com/product/c-programming-program-design-
including-data-structures-6th-edition-d-s-malik/

Object Oriented Programming with C 2 e Second Edition


Sahay

https://ebookgate.com/product/object-oriented-programming-
with-c-2-e-second-edition-sahay/

Programming in C 2nd Edition Safari

https://ebookgate.com/product/programming-in-c-2nd-edition-
safari/

Java Programming 6th Edition Joyce Farrell

https://ebookgate.com/product/java-programming-6th-edition-joyce-
farrell/
PROGRAMMING IN
ANSI C
— Sixth Edition —
ABOUT THE AUTHOR
E Balagurusamy, is presently the Chairman of EBG Foundation, Coimbatore. In the past he has also
held the positions of member, Union Public Service Commission, New Delhi and Vice-Chancellor, Anna

Fundamentals of Computers
Computing Fundamentals and C Programming
Programming in C#, 3/e
Programming in Java, 4/e
Object-Oriented Programming with C++, 5/e
Programming in BASIC, 3/e
Numerical Methods
Reliability Engineering

A recipient of numerous honors and awards, he has been listed in the Directory of Who’s Who of
PROGRAMMING IN
ANSI C
— Sixth Edition —

E Balagurusamy
Chairman
EBG Foundation
Coimbatore

Tata McGraw Hill Education Private Limited


NEW DELHI

McGraw-Hill Offices
New Delhi New York St Louis San Francisco Auckland Bogotá Caracas
Kuala Lumpur Lisbon London Madrid Mexico City Milan Montreal
San Juan Santiago Singapore Sydney Tokyo Toronto
Tata McGraw-Hill
Published by the Tata McGraw Hill Education Private Limited,
7 West Patel Nagar, New Delhi 110 008.

Programming in ANSI C (6e)

Copyright © 2012, 2011, 2007, 2004, 2002, 1992, 1982 by Tata McGraw Hill Education Private Limited.
No part of this publication may be reproduced or distributed in any form or by any means, electronic,
mechanical, photocopying, recording, or otherwise or stored in a database or retrieval system without
the prior written permission of the publishers. The program listings (if any) may be entered, stored and
executed in a computer system, but they may not be reproduced for publication.

This edition can be exported from India only by the publishers,


Tata McGraw Hill Education Private Limited.

ISBN (13): 978-1-25-900461-2


ISBN (10): 1-25-900461-9

Vice President and Managing Director—MHE: Ajay Shukla

Head—Higher Education Publishing and Marketing: Vibha Mahajan


Publishing Manager—SEM & Tech Ed.: Shalini Jha
Asst. Sponsoring Editor: Smruti Snigdha
Copy Editor: Preyoshi Kundu
Sr Production Manager: Satinder S Baveja
Production Executive: Anuj K. Shriwastava
Sr Media Developer: Baldev Raj
Marketing Manager—Higher Ed.: Vijay Sarathi
Sr Product Specialist—SEM & Tech Voc.: Tina Jajoriya

General Manager—Production: Rajender P Ghansela


Production Manager: Reji Kumar
Graphic Designer—Cover: Meenu Raghav

Information contained in this work has been obtained by Tata McGraw-Hill, from sources believed to be
reliable. However, neither Tata McGraw-Hill nor its authors guarantee the accuracy or completeness of
any information published herein, and neither Tata McGraw-Hill nor its authors shall be responsible for
any errors, omissions, or damages arising out of use of this information. This work is published with the
understanding that Tata McGraw-Hill and its authors are supplying information but are not attempting
to render engineering or other professional services. If such services are required, the assistance of an
appropriate professional should be sought.

Typeset at Tej Composers, WZ-391, Madipur, New Delhi 110063, and printed at

Cover Printer:
CONTENTS

About the Author ii


Preface to the Sixth Edition xi

1 Overview of C 1
1.1 History of C 1
1.2 Importance of C 3
3
6
7
9
10
12
13
14
1.11 Unix System 14
1.12 MS-D System 17
Review Questions 18
Programming Exercises 20

2 Constants, Variables, and Data Types 22


2.1 Introduction 22
2.2 Character Set 22
24
24
2.5 Constants 25
2.6 Variables 29
30
2.8 Declaration of Variables 33
37
38
43
45
45
vi Contents

45
Review Questions 48
Programming Exercises 50

3 Operators and Expressions 52


3.1 Introduction 52
52
55
56
57
59
60
60
61
3.10 Arithmetic Expressions 63
3.11 Evaluation of Expressions 63
64
3.13 Some Computational Problems 66
68
71
3.16 Mathematical Functions 73
Review Questions 77
Programming Exercises 80

4 Managing Input and Output Operations 83


4.1 Introduction 83
84
87
4.4 Formatted Input 88
96
Review Questions 108
Programming Exercises 110

5 Decision Making and Branching 112


5.1 Introduction 112
112
5.3 Simple If Statement 113
116
120
123
127
Contents vii

131
135
Review Questions 143
Programming Exercises 147

6 Decision Making and Looping 151


6.1 Introduction 151
153
155
158
168
176
Review Questions 184
Programming Exercises 188

7 Arrays 192
7.1 Introduction 192
194
195
197
203
207
7.7 Multi-Dimensional Arrays 215
7.8 Dynamic Arrays 216
7.9 More about Arrays 217
Review Questions 230
Programming Exercises 233

8 Character Arrays and Strings 237


8.1 Introduction 237
238
239
245
249
251
252
253
259
261
Review Questions 266
Programming Exercises 268
viii Contents

9.1 Introduction 270


270
271
274
274
277
9.7 Function Calls 278
9.8 Function Declaration 280
281
282
284
287
292
293
294
295
296
301
302
312
Review Questions 317
Programming Exercises 321

10.1 Introduction 324


324
326
328
10.5 Structure Initialization 330
331
333
10.8 Arrays of Structures 334
10.9 Arrays within Structures 336
10.10 Structures within Structures 338
10.11 Structures and Functions 340
10.12 Unions 343
10.13 Size of Structures 344
10.14 Bit Fields 344
Review Questions 351
Programming Exercises 355
Contents ix

11 Pointers 357
11.1 Introduction 357
357
360
361
11.5 Initialization of Pointer Variables 362
363
11.7 Chain of Pointers 366
11.8 Pointer Expressions 366
11.9 Pointer Increments and Scale Factor 368
11.10 Pointers and Arrays 369
372
11.12 Array of Pointers 374
375
378
11.15 Pointers to Functions 379
11.16 Pointers and Structures 382
384
Review Questions 391
Programming Exercises 394

12.1 Introduction 395


395
397
398
404
407
414
Review Questions 416
Programming Exercises 418

13 Dynamic Memory Allocation and Linked Lists 419


13.1 Introduction 419
13.2 Dynamic Memory Allocation 419
420
422
423
424
425
428
x Contents

428
429
431
435
438
440
Review Questions 448
Programming Exercises 450

14 The Preprocessor 452


14.1 Introduction 452
14.2 Macro Substitution 453
14.3 File Inclusion 457
14.4 Compiler Control Directives 457
14.5 ANSI Additions 461
Review Questions 463
Programming Exercises 464

15 Developing a C Program: Some Guidelines 465


15.1 Introduction 465
465
467
469
476
478
Review Questions 478

Appendix II: ASCII Values of Characters 485


Appendix III: ANSI
Appendix IV: Projects 491

Bibliography 555
Index 556
C
New to this Edition

pleasurable activity!

Organization of the Book

and their execution. Chapter 2 discusses how to declare the constants, variables and data types.
Chapter 3 Chapter 4 details
Chapter 5

Chapter 6
Chapters 7 and 8
covered in Chapter 8. are on functions, structures and unions. Pointers, perhaps
Chapter 11 in the most user-friendly manner.
Chapters 12 and 13 Chapter 14
Chapter 15
xii Preface to the Sixth Edition

and educational.

New colored edition

have been included in boxes.

also show real-life applications.

areas.
Numerous chapter-end questions and exercises provide ample opportunities to the readers to
review the concepts learned and to practice their applications.

questions
Separate appendix dedicated to latest compiler C99 features

Web Supplement
http://www.mhhe.com/balagurusamy/ansic6 which

E Balagurusamy

Publisher’s Note

[email protected]
Please report any piracy spotted by you as well!
1 OVERVIEW OF C

Key Terms
printf I Program

1.1 HISTORY OF C
‘C’ seems a strange name for a programming language. But this strange sounding language is one of
the most popular computer languages today because it is a structured, high-level, machine independent
language. It allows software developers to develop programs without worrying about the hardware
platforms where they will be implemented.
The root of all modern languages is ALGOL, introduced in the early 1960s. ALGOL was the

widely used in Europe. ALGOL gave the concept of structured programming to the computer science

In 1967, Martin Richards developed a language called BCPL (Basic Combined Programming
Language) primarily for writing system software. In 1970, Ken Thompson created a language using

system at Bell Laboratories. Both BCPL and B were “typeless” system programming languages.

many concepts from these languages and added the concept of data types and other powerful features.

superhighway.
For many years, C was used mainly in academic environments, but eventually with the release of

support among computer professionals. Today, C is running under a variety of operating system and
hardware platforms.
traditional C”. The language became more
‘The C Programming Language’

the programming community. The rapid growth of C led to the development of different versions of the
language that were similar but often incompatible. This posed a serious problem for system developers.
2 Programming in ANSI C

Java modelled on C

All popular computer languages are dynamic in nature. They continue to improve their power and

the usefulness of the language. The result was the 1999 standard for C. This version is usually referred
to as C99. The history and development of C is illustrated in Fig. 1.1

Fig. 1.1 History of ANSI C


Overview of C 3

Although C99 is an improved version, still many commonly available compilers do not support all of
the new features incorporated in C99. We, therefore, discuss all the new features added by C99 in an

use them wherever possible.

1.2 IMPORTANCE OF C

whose rich set of built-in functions and operators can be used to write any complex program. The C
compiler combines the capabilities of an assembly language with the features of a high-level language

functions are available which can be used for developing programs.


C is highly portable. This means that C programs written for one computer can be run on another

operating system.

Another important feature of C is its ability to extend itself. A C program is basically a collection of
functions that are supported by the C library. We can continuously add our own functions to C library.

1.3 SAMPLE PROGRAM 1: PRINTING A MESSAGE

main( )
{
/*…………printing begins………………*/
printf(“I see, I remember”);
/*………………printing ends…………………*/
}

Fig. 1.2 A program to print one line of text

This program when executed will produce the following output:


I see, I remember
4 Programming in ANSI C

program is main and the execution begins at this line. The main( ) is a special function used by the
C system to tell the computer where the program starts. Every program must have exactly one main
function. If we use more than one main
beginning of the program.
The empty pair of parentheses immediately following main indicates that the function main has no
arguments (or parameters). The concept of arguments will be discussed in detail later when we discuss
functions (in Chapter 9).
The opening brace “{ main and the closing

end of the program. All the statements between these two braces form the function body. The function

In this case, the function body contains three statements out of which only the printf line is an
executable statement. The lines beginning with /* and ending with */ comment lines. These
are used in a program to enhance its readability and understanding. Comment lines are not executable
statements and therefore anything between /* and *

in the middle of a word”.


Although comments can appear anywhere, they cannot be nested in C. That means, we cannot have

/* = = = =/* = = = = */ = = = = */
is not valid and therefore results in an error.

use them liberally in our programs. They help the programmers and other users in understanding the
various functions and operations of a program and serve as an aid to debugging and testing. We shall
see the use of comment lines more in the examples that follow.
printf( ) function, the only executable statement of the program.
printf(“I see, I remember”);
printf means that it is a function that

printf function causes

output will be:


I see, I remember
Every statement in C should end with a semicolon (;)
mark.

I see,
I remember!
This can be achieved by adding another printf function as shown below:
printf(”I see, \n”);
printf(“I remember !”);
The information contained between the parentheses is called the argument of the function. This
printf function is “I see, \n” and the second is “I remember !”. These arguments are
simply strings of characters to be printed out.
Overview of C 5

printf contains a combination of two characters \ and n at the


end of the string. This combination is collectively called the newline character. A newline character

a typewriter. After printing the character comma (,) the presence of the newline character \n causes the

printf statement, then the output will again be a single


line as shown below.
I see, I remember !

and I.
It is also possible to produce two or more lines of output by one printf statement with the use of
newline character at appropriate places. For example, the statement
printf(“I see,\n I remember !”);
will output
I see,
I remember !
while the statement
printf( “I\n.. see,\n… … … I\n… … … remember !”);
will print out
I
.. see,
… … … I
… … … remember !

Note Some authors recommend the inclusion of the statement

#include <stdio.h>

for the functions printf and scanf


for more on input and output functions.

a distinction between uppercase and lowercase letters. For example, printf and PRINTF are not the

REMEMBER”.
The above example that printed I see, I remember is one of the simplest programs. Figure 1.3
highlights the general format of such simple programs. All C programs need a main function.

main ( ) Function name


Start of program

Program statements

End of program

Fig. 1.3 Format of simple C programs


6 Programming in ANSI C

The main Function


The main is a part of every C program. C permits different forms of main statement. Following forms
are allowed.
∑ main()
∑ int main()
∑ void main()
∑ main(void)
∑ void main(void)
∑ int main(void)
The empty pair of parentheses indicates that the function has no arguments. This may be explicitly
void
int or void before the word main void means that the function does not return any
information to the operating system and int means that the function returns an integer value to the
operating system. When int

1.4 SAMPLE PROGRAM 2: ADDING TWO NUMBERS


Consider another program, which performs addition on two numbers and displays the result. The

/* Programm ADDITION line-1 */


/* Written by EBG line-2 */
main() /* line-3 */
{ /* line-4 */
int number; /* line-5 */
float amount; /* line-6 */
/* line-7 */
number = 100; /* line-8 */
/* line-9 */
amount = 30.75 + 75.35; /* line-10 */
printf(“%d\n”,number); /* line-11 */
printf(“%5.2f”,amount); /* line-12 */
} /* line13 */

Fig. 1.4 Program to add two numbers

This program when executed will produce the following output:


100
106.10
Overview of C 7

beginning to give information such as name of the program, author, date, etc. Comment characters are
also used in other lines to indicate line numbers.
The words number and amount are variable names that are used to store numeric data. The
numeric data may be either in integer form or in real form. In C, all variables should be declared to tell
the compiler what the variable names are and what type of data they hold. The variables must be
declared before they are used. In lines 5 and 6, the declarations
int number;
float amount;
tell the compiler that number is an integer (int) and amount (

The words such as int and are called the keywords and cannot be used as variable names. A

assigning a data value to it. This is done in lines 8 and 10. In line-8,
an integer value 100 is assigned to the integer variable number and in line-10, the result of addition of
amount. The statements
number = 100;
amount = 30.75 + 75.35;
are called the assignment statements. Every assignment statement must have a semicolon at the end.
The next statement is an output statement that prints the value of number. The print statement
printf(“%d\n”, number);

number should be printed as a decimal integer


The newline character \n causes the next output to appear on a new line.
The last statement of the program
printf(“%5.2f”, amount);
prints out the value of amount % f tells the compiler
that the output must be in
point.

1.5 SAMPLE PROGRAM 3: INTEREST CALCULATION


The program in Fig. 1.5 calculates the value of money at the end of each year of investment, assuming
an interest rate of 11 percent and prints the year, and the corresponding amount, in two columns. The
output is shown in Fig. 1.6 for a period of 10 years with an initial investment of 5000.00. The program
uses the following formula:

In the program, the variable value represents the value of money at the end of the year while amount
represents the value of money at the start of the year. The statement
amount = value ;
current year as the value at start of the next year.
8 Programming in ANSI C

/*—————————— INVESTMENT PROBLEM ——————————*/


#define PERIOD 10
#define PRINCIPAL 5000.00
/*—————————— MAIN PROGRAM BEGINS ——————————*/
main()
{ /*————————— DECLARATION STATEMENTS ————————*/
int year;
float amount, value, inrate;
/*————————— ASSIGNMENT STATEMENTS —————————*/
amount = PRINCIPAL;
inrate = 0.11;
year = 0;
/*————————— COMPUTATION STATEMENTS —————————*/
/*——————— COMPUTATION USING While LOOP ————————*/
while(year <= PERIOD)
{ printf(“%2d %8.2f\n”,year, amount);
value = amount + inrate * amount;
year = year + 1;
amount = value;
}
/*——————————— while LOOP ENDS ——————————*/
}
/*———————————— PROGRAM ENDS ——————————*/

Fig. 1.5 Program for investment problem

Let us consider the new features introduced in this program. The second and third lines begin with
instructions. A symbolic constant for use in the program.
Whenever a symbolic name is encountered, the compiler substitutes the value associated with the

PERIOD and PRINCIPAL and assigned values 10 and 5000.00


respectively. These values remain constant throughout the execution of the program.

0 5000.00
1 5550.00
2 6160.50
3 6838.15
4 7590.35
5 8425.29
6 9352.07
7 10380.00
8 11522.69
9 12790.00
10 14197.11

Fig. 1.6 Output of the investment program


Overview of C 9

The Directive
A is a preprocessor compiler directive and not a statement. Therefore lines should

easily distinguished from lowercase variable names. instructions are usually placed at the
beginning before the main()

program by using an assignment statement. For example, the statement


PRINCIPAL = 10000.00;
is illegal.
The declaration section declares year as integer and amount, value and inrate

as
float amount;
float value;
float inrate;
When two or more variables are declared in one statement, they are separated by a comma.
All computations and printing are accomplished in a while loop. while is a mechanism for evaluating
repeatedly a statement or a group of statements. In this case as long as the value of year is less than or
PERIOD, the four statements that follow while
statements are grouped by braces. We exit the loop when year becomes greater than PERIOD. The
concept and types of loops are discussed in Chapter 6.

in Chapter 3.

1.6 SAMPLE PROGRAM 4: USE OF SUBROUTINES


printf function that has been provided for us by the C system. The program

Figure 1.7 presents a very simple program that uses a mul ( ) function. The program will print the
following output.
Multiplication of 5 and 10 is 50

/*————————— PROGRAM USING FUNCTION —————————*/


int mul (int a, int b); /*——— DECLARATION ——————*/
/*—————————— MAIN PROGRAM BEGINS ——————————*/
main ()
{
10 Programming in ANSI C

int a, b, c;
a = 5;
b = 10;
c = mul (a,b);

printf (“multiplication of %d and %d is %d”,a,b,c);


}
/* —————————— MAIN PROGRAM ENDS
MUL() FUNCTION STARTS —————————————*/
int mul (int x, int y)
int p;
{
p = x*y;
return(p);
}
/* —————————————— MUL () FUNCTION ENDS ————————————*/

Fig. 1.7

The mul ( ) function multiplies the values of x and y and the result is returned to the main ( ) function
when it is called in the statement
c = mul (a, b);
The mul ( ) has two arguments x and y that are declared as integers. The values of a and b are
passed on to x and y respectively when the function mul ( )
considered in detail in chapter 9.

1.7 SAMPLE PROGRAM 5: USE OF MATH FUNCTIONS


We often use standard mathematical functions such as cos, sin, exp, etc. We shall see now the use of

part of C math library. If we want to use any of these mathematical functions, we must add an #include

#include <math.h>
math.h

headings.

/*——————— PROGRAM USING COSINE FUNCTION ——————— */


#include <math.h>
#define PI 3.1416
#define MAX 180
Overview of C 11

main ( )
{
int angle;
float x,y;
angle = 0;
printf(“ Angle Cos(angle)\n\n”);
while(angle <= MAX)
{
x = (PI/MAX)*angle;
y = cos(x);
printf(“%15d %13.4f\n”, angle, y);
angle = angle + 10;
}
}
Output
Angle Cos(angle)
0 1.0000
10 0.9848
20 0.9397
30 0.8660
40 0.7660
50 0.6428
60 0.5000
70 0.3420
80 0.1736
90 –0.0000
100 –0.1737
110 –0.3420
120 –0.5000
130 –0.6428
140 –0.7660
150 –0.8660
160 –0.9397
170 –0.9848
180 –1.0000

Fig. 1.8 Program using a math function

Another #include
#include <stdio.h>
stdio.h refers to the standard
12 Programming in ANSI C

The #include Directive


As mentioned earlier, C
C library. Library functions are grouped category-
. If we want to access the functions stored in

This is achieved by using the preprocessor directive #include as follows:


#include<filename>

directives are placed at the beginning of a program.

1.8 BASIC STRUCTURE OF C PROGRAMS

called functions. A function is a subroutine that may include one or more statements designed to perform
a
may contain one or more sections as shown in Fig. 1.9.

Fig. 1.9 An overview of a C program


Overview of C 13

The documentation section consists of a set of comment lines giving the name of the program,

symbolic constants.
global
variables and are declared in the global declaration section that is outside of all the functions. This

Every C program must have one main() function section. This section contains two parts, declaration
part and executable part. The declaration part declares all the variables used in the executable part.
There is at least one statement in the executable part. These two parts must appear between the
opening and the closing braces. The program execution begins at the opening brace and ends at the
closing brace. The closing brace of the main function section is the logical end of the program. All
statements in the declaration and executable parts end with a semicolon(;).
main function.
main function, although they may
appear in any order.
All sections, except the main

1.9 PROGRAMMING STYLE


free-form_language. That
is, the C compiler does not care, where on the line we begin typing. While this may be a licence for bad
programming, we should try to use this fact to our advantage in developing readable programs. Although
several alternative styles are possible, we should select one style and use it with total consistency.
First of all, we must develop the habit of writing programs in lowercase letters. C program statements

the braces are aligned and the statements are indented in the program of Fig. 1.5.

a = b;
x = y + 1;
z = a + x;
can be written on one line as
a = b; x = y+1; z = a+x;
The program
main( )
{
printf(“hello C”);
}

main( ) {printf(“Hello C”)};


14 Programming in ANSI C

comments not only increase the readability but also help to understand the program logic. This is very
important for debugging and testing the program.

1.10 EXECUTING A ‘C’ PROGRAM


Executing a program written in C involves a series of steps. These are:
1. Creating the program;

Figure 1.10 illustrates the process of creating, compiling and executing a C program. Although these
steps remain the same irrespective of the system commands for implementing the
steps and conventions for naming may differ on different systems.

output operations are channeled through the operating system. The operating system, which is an
interface between the hardware and the user, handles the execution of user programs.

both these operating systems in the following sections.

1.11 UNIX SYSTEM

Creating the Program

followed by a dot and a letter c


hello.c
program.c
ebg1.c
text editor, either ed or vi. The command for calling the editor

ed filename

to receive the new program. Any corrections in the program are done under the editor. (The name of

source program, since it represents the


original form of the program.
Overview of C 15

System Ready

Program Code Enter Program

Source Program
Edit
Source Program

Compile
C Compiler
Source Program

Syntax Yes
Errors ?

No Object Code
Link with
System Library
System Library

Executable Object Code


Execute
Input Data
Object Code

Data Error Logic Error


Logic and Data
Errors ?

No Errors

CORRECT OUTPUT

Stop

Fig. 1.10 Process of compiling and runnig a C program

Compiling and Linking


ebg1.c.

cc ebg1.c
The source program instructions are now translated into a form that is suitable for execution by the
computer. The translation is done after examining each instruction for its correctness. If everything is

name ebg1.o object code.

program. For example, if the program is using exp()


16 Programming in ANSI C

be brought from the math library


is automatically done (if no errors are detected) when the cc command is used.
syntax and semantics of the language are discovered, they are listed out and
the compilation process ends right there. The errors should be corrected in the source program with the
help of the editor and the compilation is done again.
executable object code and is stored automatically in
a.out.

cc filename - lm

Executing the Program

a.out

program does not produce the desired results. Perhaps, something is wrong with the program logic or
data. Then it would be necessary to correct the source program or the data. In case the source program

Creating Your Own Executable File


a.out. When we compile another program, this

mv a.out name
We may also achieve this by specifying an option in the cc command as follows:
cc –o name source-file
a.out from being
destroyed.

Multiple Source Files


cc command.
cc filename-1.c …. filename-n.c

filename-i.o
a.out as shown in Fig. 1.11.

cc –c mod1.c
cc –c mod2.c
mod1.c and mod2.c mod1.o and mod2.o. They can be

cc mod1.o mod2.o
Overview of C 17

.C .C .C
Compiler and
preprocessor

.O .O .O Library

Linker
a.out

Fig. 1.11

cc mod1.c mod2.o
Only mod1.c

to be used along with the program to be compiled.

1.12 MS-DOS SYSTEM

program.c, pay.c, etc. Then the command


MSC pay.c
pay.c and generate the
object code. pay.obj. In case any language errors are
found, the compilation is not completed. The program should then be corrected and compiled again.

LINK pay.obj
which generates the executable code pay.exe
pay
would execute the program and give the results.

Just Remember
∑ main() main() is illegal). The place
main is where the program execution begins.
∑ The execution of a function begins at the opening brace of the function and ends at the
corresponding closing brace.

names and output strings.
∑ All the words in a program line must be separated from each other by at least one space, or a tab,

∑ Every program statement in a C language must end with a semicolon.


∑ All variables must be declared for their types before they are used in the program.
18 Programming in ANSI C

∑ #include directive when the program refers to

∑ Compiler directives such as and include are special instructions to the compiler to help it
compile a program. They do not end with a semicolon.


closing brace.
∑ C is a free-form language and therefore a proper form of indentation of various sections would
improve legibility of the program.

in proper places increases readability and understandability of the program and helps users in

Review Questions
true or false.
(a) Every line in a C program should end with a semicolon.

(d) main( ) is where the program begins its execution.


(e) A line in a program may have more than one statement.
(f) A printf statement can generate only one line of output.
(g) The closing brace of the main( ) in a program is the logical end of the program.
stdio.h is to store the source code of a program.

true?

(b) Only one function may be named main( ).

1.3 Which of the following statements about comments are false?

(b) Comments serve as internal documentation for programmers.


(c) A comment can be inserted in the middle of a statement.
(d) In C, we can have comments inside comments.

(a) Every program statement in a C program must end with a ___________


(b) The ____________ Function is used to display the output on the screen.

on the screen.
1.5 Remove the semicolon at the end of the printf
it. What is the output?
Overview of C 19

message?

Year Amount
1 5500.00

1.8 Find errors, if any, in the following program:


/* A simple program
int main( )
{
/* Does nothing */
}
1.9 Find errors, if any, in the following program:
#include (stdio.h)
void main(void)
{
print(“Hello C”);
}
1.10 Find errors, if any, in the following program:
Include <math.h>
main { }
(
FLOAT X;
X = 2.5;
Y = exp(x);
Print(x,y);
)
1.11 Why and when do we use the directive?
#include directive?
1.13 What does void main(void) mean?

(a) main( ) and void main(void)


(b) int main( ) and void main( )
1.15 Why do we need to use comments in programs?
20 Programming in ANSI C

Programming Exercises
1.1 Write a program that will print your mailing address in the following form:

Third line : City, Pin code

value and assume a suitable value for radius.


1.6 Write a program to output the following multiplication table:
5¥1= 5

5 ¥ 3 = 15
∑ ∑
∑ ∑
5 ¥ 10 = 50

difference in the following form:

1.8 Given the values of three variables a, b and c, write a program to compute and display the value
of x, where
a
x=
b-c
Execute your program for the following values:

(b) a = 300, b = 70, c = 70


Comment on the output in each case.
Overview of C 21

1.9 Relationship between Celsius and Fahrenheit is governed by the formula


9C
F= + 32
5
Write a program to convert the temperature
(a) from Celsius to Fahrenheit and
(b) from Fahrenheit to Celsius.
1.10 Area of a triangle is given by the formula
A= S(S-a) (S-b) (S-c)

area of the triangle given the values of a, b and c.


1
, y1) and (x , y ) is governed by the formula
= (x – x1) – y1)

of the circle. Write a program to compute the area of the circle.

for a = 5, b = 8 and c = 18.


1.15 Write a program to display the following simple arithmetic calculator

x= y=
sum
Product =
2 CONSTANTS, VARIABLES,
AND DATA TYPES

Key Terms

2.1 INTRODUCTION

data
information.
program.
syntax rules
grammar

2.2 CHARACTER SET

Trigraph Characters
Constants, Variables, and Data Types 23

Table 2.1 C Character Set

Letters Digits

Special Characters

White Spaces
24 Programming in ANSI C

Table 2.2 ANSI C Trigraph Sequences

Trigraph sequence Translation

2.3 C TOKENS
tokens

C TOKENS

Keywords Constants Strings Operators

float –15.5 "ABC" + –


while 100 "year" * ,

Identifiers Special Symbols

main []
amount {}

Fig. 2.1 C tokens and examples

2.4 KEYWORDS AND IDENTIFIERS


keyword
Constants, Variables, and Data Types 25

Note C99 adds some more keywords. See the Appendix “C99 Features”.

Table 2.3 ANSI C Keyword

auto double int struct

2.5 CONSTANTS

Integer Constants
integer decimal
octal hexadecimal
26 Programming in ANSI C

Fig. 2.2 Basic types of C constants

Note

octal

hexadecimal

Program 2.1
Constants, Variables, and Data Types 27

Program
main()
{
printf(“Integer values\n\n”);
printf(“%d %d %d\n”, 32767,32767+1,32767+10);
printf(“\n”);
printf(“Long integer values\n\n”);
printf(“%ld %ld %ld\n”, 32767L,32767L+1L,32767L+10L);
}
Output
Integer values
32767 -32768 -32759
Long integer values
32767 32768 3777

Fig. 2.3 Representation of integer constants on 16-bit machine

Real Constants

real

decimal notation

exponential notation

mantissa e exponent
mantissa decimal notation exponent
plus minus sign e
28 Programming in ANSI C

Table 2.4 Examples of Numeric Constants

Constant Valid? Remarks

Single Character Constants

single

number 5.

printf(“%d”, ‘a’);

printf(“%c”, ‘97’);

String Constants
double
Constants, Variables, and Data Types 29

Backslash Character Constants

escape sequences.

Table 2.5 Backslash Character Constants

Constant Meaning

2.6 VARIABLES
variable

amount
30 Programming in ANSI C

Total total
TOTAL.

Table 2.6 Examples of Variable Names

Variable name Valid ? Remark

avg_height and avg_weight

ht_average and wt_average

2.7 DATA TYPES


data types.
Constants, Variables, and Data Types 31

(int), char
double) void.
long int long double

Note C99 adds three more data types, namely _Bool Complex, and _Imaginary. See the
Appendix “C99Fatures”.

PRIMARY DATA TYPES

Integral Type

Integer Character

signed unsigned type char


int unsigned int signed char
short int unsigned short int unsigned char
long int unsigned long int

Floating point Type


void
float double Long double

Fig. 2.4 Primary data types in C

Table 2.7 Size and Range of Basic Data Types on 16-bit Machines

Data type Range of values

int
32 Programming in ANSI C

Integer Types

short int
short int, int, long int
int, signed unsigned
long int

short int Fig. 2.5 Integer types

int

long unsigned signed

Note C99 allows long long integer types. See the Appendix “C99 Features”.

Table 2.8 Size and Range of Data Types on a 16-bit Machine

Type Range
Constants, Variables, and Data Types 33

Floating Point Types

float

double

double long double


double
Fig. 2.6 Floating-point types
double precision

long double

Void Types
void
void

Character Types
character(char)
signed unsigned
unsigned chars signed chars

2.8 DECLARATION OF VARIABLES

Primary Type Declaration

data-type v1,v2,....vn ;

int count;
int number, total;
double ratio;
Other documents randomly have
different content
CHAPTER XI
SEARCHING FOR THE MAN WITH A SCARRED
HEEL

A drove of thirty or more horses and half as many pack mules


were quartered in the large corral behind the barracks for the use of
the rurales stationed at Necaxa. From among them a rather docile
mustang was selected for Jack. While a native was saddling the
horse, a mozo, or Indian servant, arrived with the engineer’s steed,
a beautiful creature that had cost Mr. Ryder nearly three hundred
Mexican dollars, which is a very high price indeed to pay for horse
flesh in that country. Three of the rurales were detailed to
accompany them as a special guard and before leaving the enclosure
the entire party made a careful inspection of their firearms.
For the first two miles the trail skirted the high bank of the river
and was wide enough to permit the men to ride two abreast. The
three soldier-policemen took the lead while Jack and the engineer
brought up the rear, and as their horses jogged along Mr. Ryder
explained briefly the life of the Mexican Indians since the conquest
of the country by adventurers from across the sea.
“These natives,” he said, “have been veritable slaves since their
ancestors yielded to Spain’s warriors. The peons, who are all Indians
or half-breeds, are the lowest type of Mexicans. They are
uneducated and uncivilized and for that reason they rarely advance
above the class of servants and laborers. Since the day they were
conquered they have been without opportunity, however, so we
cannot blame them altogether for their condition. There is every
reason to believe, from the relics that are left to-day, that the
Mexican Indians were semi-civilized at least. They erected
magnificent temples, they laid out large cities, and they even built
aqueducts and sewer systems. Indeed, they were much farther
advanced than the North American Indian of the plains, but with the
advent of the Spaniards they began to deteriorate for the simple
reason that they were not allowed to progress. As you already know,
a man or a nation cannot stand still. It must either develop or
retrogress. The Spaniards made slaves of the Indians and while they
are not slaves in name to-day they might just as well be, for they
have not as much freedom as the negro had in the United States
before the Civil War.
“The peons live as tenants on haciendas, or large farms, where
they till the soil and raise crops. For this work they are paid a few
centavos a day which in American money does not amount to five
cents; with this pittance they are supposed to buy food and clothes.
But the hacienda owners sell them food and clothes at a figure far
above their daily earnings and as a result the Indian is always in
debt to his master. And since it is a capital offense in Mexico for an
employee to leave an employer while still in debt to him, the peon is
bound to the hacienda on which he is born for the rest of his life. He
can never leave and he can never cease working for the same man.
Whole communities of natives are often controlled in this way by
Mexican farmers.”
“It seems ridiculous that such conditions can exist to-day,” said
Jack, very much surprised at this revelation. He had always
considered the Mexican Indian as a shiftless being who did not work
and lived from hand to mouth simply because of his own laziness.
“Do not get the idea that these natives are blind to their present
condition or that they do not care to elevate their general plane of
existence,” continued Mr. Ryder. “They are just as eager for a chance
to advance as is the Jew or other foreigner who immigrates to
America. That is the reason why the present revolution is being
waged in the north by Carranza and Villa, and that is why our
bloodthirsty friend Zapata has so many peon followers.
“The only trouble is the moment one of these revolutions is
successful and the new leader is in power all pledges to the peon
are forgotten and the native goes back to exactly the same condition
that he has been fighting to clear himself from. It is a very unhappy
situation, but some day, perhaps, a leader will keep his promise to
his people. Then the huge haciendas, which often embrace hundreds
of thousands of acres, will be confiscated and this land with the
millions of acres of government land will be cut up into small farms
and sold to the natives at reasonable terms exactly as our country
opened up the great West. When this happens Mexico will develop
into a wonderful nation. Give these people public schools and the
other advantages of civilization and you will soon see what kind of
stuff they are made of. The old Indian blood is strong in them and
Indians, properly trained, often make excellent men.”
Mr. Ryder’s talk had changed Jack’s opinion of the peons a great
deal. Indeed, he soon found that instead of despising them he was
sympathizing with them. He could not understand, however, how the
engineer could feel kindly disposed to the natives when they were
causing him so much trouble. He was on the point of mentioning this
thought when Mr. Ryder spoke again.
“I feel very sorry for the peons even though I am an agent of
Huerta. But as I have weighed it out, my duty to my employer
comes first no matter whether the employer is a scoundrel or not. It
is not for me to judge. I am asked to keep Mexico City illuminated
and I will keep the lights burning no matter who is in the National
Palace, and, moreover, I’ll do it in spite of this man with the scarred
foot, whoever he is.”
Thus recalled to their mission, Jack instantly became attentive to
their surroundings. He found that the trail had narrowed and that
the rurales ahead had formed in single file. His little mustang was
patiently picking its way through rough places and underbrush to
keep beside the animal ridden by the engineer.
“I guess we have been talking too much and paying too little
attention to our horses, Jack,” said Mr. Ryder. “Push ahead and get in
single file. This is a section of the trail that carries us over the
shoulder of a mountain and it is rather narrow.”
Soon the shoulder was topped, however, and the horses began to
descend in single file toward the Indian village. The community was
somewhat larger than the villages Jack had seen from the train
window on his way to Mexico City, otherwise it was the same
collection of dilapidated huts that looked as if they had been literally
thrown together by their builders.
As they drove down through the single street a regiment of
barking dogs and screaming naked Indian children greeted them.
Robust, dark-skinned men lounged about before the huts (most of
them clad in pajama like cotton garments), while their women folk
worked hard at grinding corn between stones or carried water from
the river in tall earthen jugs which they balanced deftly on their
heads. Down at the river bank Jack could see other women busy
washing clothes. This laundry work was accomplished by pounding
the garments between stones much to the detriment of the
garments, for the hard stones rubbed innumerable holes in the cloth
as Jack found later when he gave his linen to a native
washerwoman.
In the village Mr. Ryder took the lead and Jack followed, leaving
the rurales to their own diversions. The engineer drove toward a
more pretentious hut than the rest, where a very much wrinkled old
Indian sat sunning himself before the door and idly watching a half
dozen scrawny razorback pigs rooting in the dirt almost at his very
feet.
The two Americans reined up before the house and viewed the
picture that the old fellow made as he sat there staring absently at
the animals.
“That,” said Mr. Ryder, “is Señor Yuai and his pigs. Pigs and
vultures, as you know, are the scavengers of Mexico. But for their
able services the country would be unfit to live in because of its filth
and carrion. And Señor Yuai, though he is neither pig nor vulture, is
also a very useful inhabitant. He is the Indian doctor who attends to
all the natives in this vicinity. The old fellow is very much looked up
to and every one comes to him for advice. He is aged and very
nearsighted but his mind is as keen as ever. He knows every peon
for miles around and I’ve an idea that he can identify our trouble
maker with the scarred foot if he wants to. Come, we’ll hear what he
has to say on the question.”
The Americans dismounted and after kicking their way through the
drove of grunting pigs confronted the austere old Indian. Señor Yuai
peered up at them with eyes bleared by age and demanded in
Spanish to know whose shadow fell across his doorway. (The
following conversation then took place which Mr. Ryder translated for
Jack’s benefit.)
“It is I, Señor Ryder, from the electrical plant,” said the engineer.
“Gringo friend come over mountain to see me?” asked the old
Indian.
“Yes, I’ve come to see you, Señor Yuai, but not because I am sick
of calentura. It is another reason. Tell me, in all your years do you
remember a peon ailing of a cut heel. Did you ever cure a very deep
wound that would leave a scar across a peon’s heel, thus?” Mr. Ryder
illustrated his question by drawing his finger diagonally across the
old man’s heel. The Indian was silent a long time and while his
memory went slowly back over the many years he had been
doctoring the natives, Mr. Ryder slipped a cigarette between his lean
old fingers, saying, “Here, Señor Yuai, perhaps a little smoke will
make you remember better.”
The Indian accepted the roll of brown paper and tobacco with a
grunt of satisfaction and lit it on the glowing end of Mr. Ryder’s own
cigarette which the engineer held for his convenience.
For five minutes the old native puffed in silence, exhaling great
clouds of blue smoke from time to time. Finally he spoke.
“As many years ago as I have fingers came a young man to see
me. He had stepped on a machette and the flesh of his foot was laid
open to the bone. My medicine cured him. Soon he could walk, he
could run, he could swim. He was a fine big fellow. He could shoot
well, he could ride well and he was a good boy except he liked
pulque too much. One day he went away. Two summers later he
came back in clothes as green as the banana palm. He was then a
rurale. He went away again and never came again. His name—ah—
his name went with him.” Here the Indian touched his forehead with
his finger as he spoke and this action told the American plainer than
his words that he had forgotten the young man’s name.
Jack and the engineer looked at each other significantly when
Señor Yuai finished speaking.
“Can it be that we have traitors among our rurales!” demanded Mr.
Ryder incredulously.
CHAPTER XII
THE DRAWINGS ARE STOLEN

“Well, this is a mighty serious state of affairs,” said the engineer as


they returned to their horses and prepared to remount.
“Yes, indeed, and from all appearances we have a real enemy to
contend with,” replied the lad.
“You are right, we have,” confirmed Mr. Ryder. “If our man with
the scarred foot is a member of the rurales, we are going to have
the devil’s own job locating him too. We cannot accuse at random
and moreover we cannot take our troubles to the captain, for the
reason that where there is one traitor there are likely to be many
more. The captain may be a revolutionist himself, and if he is,
heaven help us when he finds out that we have a way of identifying
the trouble maker. We would be murdered in less than a week. I
think we had better feel our way very slowly before we make an
arrest.”
“But why should a rurale go traveling about in his bared feet at
night?” queried Jack, suddenly discovering a puzzling question.
“I thought of that myself,” confessed the engineer, “and the only
reason I can give is that the culprit is always afraid that the jingle of
his big spurs will attract attention and rather than remove them he
removed his boots instead and goes about his work silently. That
sounds perfectly plausible, doesn’t it?”
“By George, that’s capital reasoning! I believe you’ve hit it exactly
right,” exclaimed the lad enthusiastically.
“I see our three guards over on the river bank,” said Mr. Ryder,
abruptly changing the subject; “we’ll drive over and join them there,
for I’ve an idea that our horses could stand a drink before starting
for the plant again.
“And by the way,” he warned as they urged their mounts forward,
“I wouldn’t say much about our friend of the scarred foot in the
presence of the rurales either here or at the plant, for you never can
tell just how much English some of these fellows understand. I’m a
little worried over the impression that our search among the peons
created, even though I did tell the captain the falsehood about the
suspected leper. Who knows, perhaps the very man we are after was
looking on all the time. In that case our lives are in danger every
moment. He would kill us rather than run the chance of being
identified.”
It was quite evident to Jack that the engineer regarded the
business at hand as rather hazardous and the lad from Vermont
could not help feeling slightly concerned about his own safety. He
put on a bold front before Mr. Ryder, however, for he did not care to
have the engineer think that he was the least bit worried.
The river’s course through the valley was broad and the stream
ran sluggish and shallow where it passed the village. Indeed, just
below the point where the women were washing on the rocks was a
ford, with a sloping sandy beach on either bank. Here it was that the
pack trains leaving the valley toward the north crossed the stream.
On the bank opposite, Jack saw several large alligators sunning
themselves, and here and there on the surface of the water he also
saw the scaly backs and heads of others that had come up to rest
awhile and get a fresh supply of air. Some of them were fully ten
feet long.
But in spite of the presence of these reptiles, the horses did not
hesitate to wade belly deep into the stream and cool themselves
while they slaked their thirst. Jack noticed this and remarked about
it to Mr. Ryder.
“Alligators are not disposed to attack anything very large,” said the
engineer, “although sometimes they do make away with sheep and
small calves that come down for a drink. The ’gator is not as
ferocious as his cousin the crocodile and I have never heard of any
natives being devoured by one, in spite of the fact that the Indians
wade the ford here daily.”
Mr. Ryder had hardly finished speaking when a young Indian
appeared on the opposite bank followed by a full-grown hound dog.
The native was clad only in abbreviated canvas trousers and slung
across his back was a tiny mail bag. Jack learned later that his first
name was Miguel and that his last name was almost
unpronounceable, also that he was the official runner, or messenger,
of that section of the country, and that his forefathers had been
runners as far back as the days of Montezuma.
The native stood knee deep in the river a moment and emitted
several loud whoops at the same time churning the water furiously
with his feet. At this the alligators on the bank slipped into the water
with a splash and every scaly back and head disappeared. Then the
Indian plunged into the stream and waded across, at the same time
coaxing the dog to follow. The hound stood whining at the water’s
edge, however, and the messenger reached the opposite shore
before the animal found sufficient courage to follow. Finally, after
much coaxing, he took the plunge and swam toward his master. But
he had scarcely passed the middle of the stream when he began to
whine again, half raising himself out of the water with his frantic
efforts to swim faster. The next instant there was a swirl just behind
him and an ugly head appeared on the surface. The dog fairly leapt
out of the water at this but he could not avoid the reptile whose
dripping jaws closed upon one hind leg.
The native shouted wildly and plunged back into the river again to
rescue his pet. But before he had gone two steps, Jack, with great
presence of mind, whipped out his revolver. Twice he fired and each
bullet found its way into the scaly body. Instantly the water was
lashed into foam by the death struggle of the monster. The great
jaws opened wide and the reptile awoke the echoes in the hills with
a bellow like that of an angry bull. Then it sank out of sight.
Half drowned and with one leg dangling limp and useless the
hound dragged itself from the river. The young Indian lifted it in his
arms and caressed it gently, at the same time talking effusively to
Jack. Of course the American could not understand the messenger,
but it was quite evident from the expression on the red man’s face
that he was very grateful to Jack and that he admired his quick and
accurate shooting.
“What is he saying?” asked the Vermonter, turning to Mr. Ryder.
“He says that you are a very good marksman and that you have a
warm heart for a gringo. He promises never to forget your kindness.”
Jack smiled his acknowledgment and prepared to remount his
horse, which with the others had withdrawn from the river when the
struggling alligator began its frenzied lashing of the water.
It was past midday when the five riders started on their return
journey toward the power plant, and the heat was intense. However,
as soon as the horses had climbed out of the valley the trail led
through a dense forest where huge trees and thickly matted vines
shut out all sunlight and all heat as well. Travel, under such
circumstances was thoroughly enjoyable, and the five riders swung
along in single file until they reached the open country in the vicinity
of the great hydro station again.
“Well,” said Jack as he reined in beside Mr. Ryder at the gate in
the barbed-wire barricade, “I thought you said the woods were full
of rebels. We haven’t seen a sign of one all day long. What do you
make of it?”
“It is more than likely that they are off in some other section of
the hills, burning and pillaging. But don’t think that they haven’t an
eye on us, for they have and you’ll see signs of them again before
long, I’ll warrant.”
The soldier on guard at the gate had unfastened the intricate lock
by this time and the cavalcade entered. The rurales hurried off at
top speed to their long low barracks hall where they hoped to find
the remains of the noonday mess. And as for Jack and the engineer,
they were not slow in reaching the cottage, for they knew that
faithful old Tom Why had something tempting waiting for them.
A mozo met them as they reined in before the door and when
they had dismounted he took charge of the horses. The few hours in
the saddle had been rather tiresome to the lad, for he was not
accustomed to that form of exercise. Indeed, the shaking up he had
received on horseback and the lack of sleep the night before had
made him so thoroughly fatigued that even the cartridge belt and
holster weighed heavily on his hips and as he walked toward the
cottage he started to unbuckle the leather girdle. Just as he was
mounting the steps the buckle opened suddenly and the belt swung
free, upsetting the holster and toppling the revolver to the ground.
Hastily Jack stooped to pick it up. But as he reached down he
caught sight of a naked footprint in the dust! He bent closer, hardly
able to believe what he saw! The footprint bore the mark of a deep
scar diagonally across the heel!
“Hi! Mr. Ryder! Look! Our man with the scar paid a visit here as
well!” he shouted to the engineer, who had already entered the
cottage.
Mr. Ryder hurried out and examined the footprint with Jack.
“By George, you’re right! What could he have wanted up here!”
exclaimed the engineer.
Jack did not wait to answer the question. He bolted into the house
and rushed to the flat-topped desk, for he had suddenly thought of
the precious blueprints. Eagerly he drew open the top drawer into
which he had seen Mr. Ryder drop the yellow envelope the evening
before. But the compartment was empty! The drawings were gone!
CHAPTER XIII
A WEAKENED GARRISON

With the disappearance of the engineer’s drawings the mystery


that surrounded the man with the scarred foot was doubled. Neither
Jack nor Mr. Ryder could be quite positive of the clue they had been
following. To them the fact that the trouble maker went about
without shoes argued that he was a peon, and they could well
understand why a peon, imbued with the spirit of revolution, should
seek to make conditions as uncomfortable as possible for President
Huerta, against whose rule they were revolting. That the person in
question should undertake to wreck the power plant, or portions of
it, seemed quite natural. But when it came to stealing drawings that
were absolutely useless to them the whole affair took on a different
complexion.
Who was this individual with the scar on his foot? Was he a peon
or was he some one of the other employees about the plant? Or
again, was he a soldier, or a member of the band of rurales, or was
he some one of the bandits in the mountains who ran the guard at
night and accomplished his trickery under the very eyes of soldiers
and employees? The whole situation was thoroughly muddled and
Jack and Mr. Ryder spent days trying to fathom the knotty problem.
To a technical man the drawings were of the utmost value, for they
laid bare to him the secret of an invention that would make him
wealthy. But on the other hand it would seem that the man was
moved more by his sympathies with the revolutionists than by his
desire for personal gain, since it was quite apparent that the person
who was so industriously engaged in making things disagreeable for
President Huerta and the man who stole the drawings was the same
individual.
“It is a mighty peculiar situation,” said Mr. Ryder one evening,
after he and Jack had been puzzling over the matter for several
hours. “This is my only conclusion. The man must be a peon, or a
soldier, for they are the only persons hereabout who are interested
in the revolution at all. He has heard of the drawings somehow, and
believing that they would be of value to Zapata or Carranza (or
whoever else he favors), he stole them. Later on he will probably
turn them over to some one of these leaders with the hope,
perhaps, that he will be given a commission or some other form of
recognition for his service to the cause.
“But after I have reached that conclusion,” he added, “I am not
absolutely certain that I am shooting in the right direction.”
For some time after the disappearance of the papers everything
ran smoothly at the plant. But in the meantime disconcerting rumors
were coming in from the mountains about bands of Zapatistas who
were gathering at all points. The rurales who went out to patrol the
hills and in particular to ride the transmission line to see that it was
not disturbed were the first to bring in reports of skirmishes with
these rebels. Almost daily several of the soldier-policemen would
locate a handful of armed natives somewhere in the hills. Always a
fight followed which resulted in at least one or two fatalities. More
than once these green-clad riders came into Necaxa with dead or
wounded comrades in their arms. And on several occasions they
appeared at the power plant with prisoners bound hand and foot
and tied to the backs of horses or burros like so many sacks of flour.
Short work was made of these men. Their fate was sealed the
moment they were captured by the rurales. As a matter of form they
were given a drumhead trial; that is, they were taken before the
chief officer of the rurales and asked a number of unimportant
questions. No matter how these questions were answered the
sentence was the same. The natives were always condemned to be
shot at sunrise the following morning.
Jack was present at the trial of one of these unfortunates and
after the rebel was taken to the guardhouse the lad and Mr. Ryder
went to visit him. It gave Jack a rather uncanny feeling when he
realized that the man with whom they were talking would be dead
and cold in ten hours. The Vermonter was up before sunrise to see
the prisoner led out and placed against the gray wall of the power
plant. The firing squad was composed of five men and an officer
who stood with sword drawn while a soldier bound a handkerchief
about the eyes of the victim. When this was done the executioners
took careful aim and waited for the abrupt command to fire.
The five guns roared simultaneously, and Jack grew sick as he saw
the blindfolded figure sway backward first, then recover its balance
only to pitch forward with a groan and become an inert and lifeless
mass. When the smoke had cleared away the officer walked calmly
up to the dead man and drawing his revolver emptied the entire six
chambers into the already lifeless body. This, Jack learned, was
prescribed by the military regulations of Mexico, which state that an
officer in charge of a firing squad, is held responsible for the certain
death of the victim.
The rurales, however, were not the only ones to bring in word of
the gathering of the Zapatistas. One day three men left the plant on
a handcar trip of inspection along the narrow gage railroad track.
One took a Winchester rifle with him while the others carried their
revolvers. On their return journey they were met at a bend in the
road by six rebels. One had a rifle but the others were armed only
with machettes, or long brush knives. The men from the plant were
ordered to stop, of course, but they did not obey. Instead they
started to pump the handles harder and since the tracks were down
grade at that point their car had gained tremendous headway by the
time they reached the natives. Fortunately the peons had not had
forethought enough to plug the railroad tracks or loosen a rail in
which case the car would have been wrecked and the inspectors
killed immediately. As it was they ran past the natives at top speed.
The Mexican with the rifle opened fire and the man with the
Winchester replied, but he was only able to get in one shot before
the handle of the car knocked the rifle from his grasp. One of the
other men drew his six shooter and emptied it as he went flying
past. It was a narrow escape and the three inspectors were glad
when they reached the power plant.
Shortly after this experience some excitement was created at the
station when Lyman noticed that one of his indicators recorded a
grounded transmission line. Two linemen and a squad of rurales
were despatched to locate the trouble. Five miles back in the
mountains they found a dead peon clinging to one of the steel
transmission poles and the story of the ground was revealed
instantly. This peon had climbed the pole and with his steel
machette tried to cut through one of the transmission lines. The
moment the blade came in contact with the cable a circuit was
formed and the entire 88,000 volts were sent through the man’s
body. His companions, seeing his fate, had fled without even
attempting to rescue him.
These demonstrations on the part of the rebels did not add to the
peace of mind of the men at the power plant. Indeed every one
began to feel the strain, for the station was veritably in a state of
siege. Rumors came into Necaxa by way of the peons from the
Indian village down the valley, that José Cerro, one of the fiercest of
the mountain bandits and a strong ally of Zapata, was in charge of
the horde that was gathering in the hills in that vicinity. After that no
one felt inclined to leave the station except when accompanied by a
guard of rurales and all inspection of railroad and transmission lines
was done with the aid of soldiers.
Then one day in the midst of it all the officer in charge of the
infantry reported to Mr. Ryder that he had been in communication
with General Rodriguez and had received orders to move his entire
detachment back to Mexico City. The engineer could not believe his
ears. With all haste he called up the capital on the long-distance
telephone.
“Why, you won’t need soldiers out there any longer,” said the
military officer after the engineer had protested vigorously to the
removal of the guard. “You don’t need soldiers because Zapata is
moving his whole army toward the Atlantic coast. He’s evidently
heard of the shipment of arms coming in on the German steamer
and hopes to intercept them on their way to the capital. If he takes
the railroad we are lost. That’s why we want your soldiers. We must
have them. The rebel chief has withdrawn all his men from your
section of the country so I’m sure you won’t need them.”
“Oh, is that so,” said Mr. Ryder, thoroughly angry. “Well, there are
a few hundred lurking out here in the woods just now and I am
expecting an attack almost any time.”
“You are mistaken, I am sure,” said the officer; “there may be a
few bandits about in the mountains but the Zapatistas have all
followed their leader. I am very sorry, but we need all the soldiers
you have at Necaxa. However, if you are at all alarmed I will leave
you a detachment of twenty-five infantrymen who, with the squad of
rurales you have stationed there, will be able to defend the place
against a few bandits. Good-by.”
The soldiers entrained that very afternoon, much to the chagrin of
Mr. Ryder and the other Americans.
“By George, this is the queerest piece of work I have ever seen,”
said Mr. Ryder. “If Zapata has moved his men, José Cerro did not
follow his leader, for he’s out there in the mountains with two
hundred men and he’ll swoop down on us in short order when he
hears how weak our garrison is. Just watch how bold those greasers
get when they learn that the infantry has been called back to Mexico
City.”
CHAPTER XIV
THE NIGHT WATCH

Mr. Ryder’s prediction came true. It was not two days later when a
half dozen peons appeared on the edge of the forest and occupied
their time shooting out the windows in the workmen’s cottages and
sending leaden greetings to any one who appeared out of doors.
They remained in their positions until the soldiers mounted a light
machine gun in the window of the barracks house and poured a rain
of steel-jacketed bullets in their direction. But José Cerro’s followers
were not the only ones who were made bold by the withdrawal of
the troops. The traitor inside the power plant became active too.
One evening while Jack and Mr. Ryder were partaking of one of
Tom Why’s elaborate meals, Phil Underwood, the young American
whose duty it was to take care of the huge searchlight, rushed into
the dining room.
“Mr. Ryder,” he exclaimed with a savage note in his voice, “there’s
a peon in Necaxa I’d like to lay hands on. He’s that blasted
sympathizer. If I knew who he was I’d choke him to death. What do
you think he’s done now to help that bunch of cutthroats out there
in the mountain? He’s put the big searchlight out of business! He’s
wrecked the entire outfit and there isn’t a place this side of New
York where we can get the broken parts replaced! It looks as if we
were up against it for sure.”
The engineer looked thoroughly worried.
“When did it happen?” he demanded.
“The light was all right up to dawn this morning. I shut it off
promptly at four o’clock, put the canvas jacket over it and went to
bed. When I tried to start it a few moments ago I found the whole
mechanism gone to smash.”
For a long time Mr. Ryder was silent. His brow was wrinkled and it
was evident to both Phil and Jack that the situation was causing him
some deep thought. Finally he spoke.
“Look here, Phil, this condition is mighty serious and I am at a loss
to know exactly how to proceed. I think the best plan is not to
mention this last piece of treachery. Merely go to Lieutenant
Hernandez and tell him that the searchlight suddenly became out of
order and until we can repair it or make better arrangements he
must keep a double guard along the barricade and the first trench. If
we spread the news about this broadcast we can’t tell what sort of
an effect it will have on the soldiers. Mexicans are a peculiar lot, you
know, and for that reason alone I think it would be far better for us
to keep this incident secret. In the meantime you and Jack and
myself can keep a watchful eye on everything in general and I’ll try
to work out a plan for an improvised searchlight.”
“Very good, sir,” said Phil, as he hurried off to the military
barracks.
When the youth had gone Mr. Ryder turned to Jack and said: “I
trust you are still willing to help me in this difficulty, my boy.”
“You’re right I am,” exclaimed Jack enthusiastically, “I am as much
interested as if I were employed here and I’ll do anything I can to be
of assistance.”
“Very well then, Jack, I’ll look to you to do a man’s share of the
watching around here until we can get things straightened out. This
trouble with the searchlight may mean that a night attack is
impending. I purpose doing some guard duty myself to-night and I
should like to have you help me out. Will you?”
“Only tell me what you want of me and I’ll do it without a word of
protest,” said Jack loyally.
“Well, suppose you buckle on your revolver now and start
patroling the village. Keep an eye out for anything that does not look
absolutely normal. At midnight report back to the cottage here and
wake me up. I’ll do my trick between midnight and dawn, for I do
not intend that this traitor shall get in any more of his underhanded
work without being caught at it.”
“That’s a capital scheme,” said the young Vermonter and finishing
his coffee he hurried to his room. There he secured his belt and
holster which he had tossed on his bed an hour previous. Also
before he left he rummaged through his traveling bag until he had
located a tiny electric pocket flash lamp which he had brought with
him all the way from Drueryville. Ten minutes later he was
sauntering down the single narrow street toward the power plant.
Darkness was just coming on as the sentries were changed and
the lad watched the small squad of regulars leave the barracks and
take their places at various points around the tiny village.
“I wonder,” mused the boy, “how many actually keep awake all
night? I’ll warrant half of them find some sheltered spot and go to
sleep after midnight.”
For an hour or two the little community resembled the quarry
towns of far off Vermont to such a degree that Jack actually became
a little homesick as he viewed the scene. Every cottage window
glowed with cheerful light and the day men, free from their tasks for
a while, were indulging in the only sociability Necaxa afforded: that
was to gather in twos and threes on cottage porches and spend the
evening in telling stories and smoking. Now and then some one of
these groups would burst forth in songs and what the tunes lacked
in harmony was made up for in the enthusiasm of the singers. Most
of the songs Jack recognized as having been popular back in the
States two years before.
At half past nine the groups began to dwindle, the men going off
to their various cottages. One by one the lights went out and by ten
o’clock the place was in total darkness, save for the lights in the
power plant. Jack felt very lonesome then. Except for the steady
grumble of the generators inside the big gray building, not a sound
disturbed the stillness. From place to place about the village the
youth roamed, peering here and there for signs of trouble. But
mostly he watched in the vicinity of the power plant.
This constant vigil was very tiresome, however, and several times
he paused in a secluded angle of the building and flashed his electric
lamp on the face of his watch. He was thoroughly glad when the
hands pointed out the hour of midnight.
He made one more tour of inspection after that, then started up
the street toward Mr. Ryder’s cottage. He had almost reached his
destination when suddenly his attention was attracted by a gray
shadow moving between two cottages some distance to his left. Jack
remembered that both buildings were occupied by Mexican linemen
and his suspicions were aroused immediately. As softly as a panther
he moved across the roadway and gained the corner of one of the
buildings. The shadow still lingered in the alley and the youth softly
slipped his revolver from its holster. But just as he was on the point
of calling to the man to throw up his hands he became aware of
another gray shadow moving about. This one was coming stealthily
up the roadway he had just left and Jack thanked his lucky stars that
he had hidden himself when he did.
It was quite evident to the Vermonter that the two shadows
intended to meet, but in order to accomplish this either one or the
other must pass within six feet of him. For a moment he scarcely
knew what to do, for he realized that he could not handle two men
at once.
The man in the alley had paused, but the one in the roadway
came forward softly and swiftly. When he was within fifteen feet of
the crouching youth Jack could see him quite distinctly. He wore a
very broad hat and the tight jacket of a rurale. Of a rurale! Instantly
the old Indian doctor’s story about a rurale with an injured foot
flashed upon him! This must be the man of the scarred heel!
Throwing all caution to the wind, Jack dropped his revolver and
leapt toward the shadowy figure. It was a perfect flying tackle and
the man came down with a crash, his legs pinned tightly together,
exactly as Jack had pinned the legs of many an opposing fullback on
the field at Drueryville.
The attack was so sudden that the man lay stunned for a moment.
Then as if he suddenly realized that it was a human being and not a
vice that had gripped him, the soldier began to struggle. He tried to
kick and squirm his way out of the boy’s arms, at the same time
thrashing about with his fists and cursing lustily in Spanish. He was a
big man and exceedingly powerful and Jack had all that he could do
to hold him on the ground.
The lad had the advantage, however, since the native was almost
flat on his stomach. By careful maneuvering and the help of two or
three wrestling holds that are known to every American boy he was
soon able to work himself astride the prostrated one and pin the
refractory hands down as well. This accomplished, the youth began
to shout for help at the top of his voice.
Mr. Ryder was first on the scene. He came running across from his
cottage, a revolver in one hand and an electric flash lamp in the
other. The Mexican linemen came tumbling out of their cottages a
few moments later and immediately after two Mexican regulars
arrived, all out of breath.
“Well, I think we’ve captured our man,” said Jack, panting in his
excitement. “Here, lay hold of this fellow, so I can stand up.”
The soldiers seized the prostrated one but they still kept him
pinned flat on his stomach, in spite of his protests.
“Mr. Ryder,” said Jack, “I think this is the man with the scarred
foot. Turn your light this way until we have a good look at his feet.
He hasn’t any boots on, that’s certain, for he moved about like a
cat.”
Hurriedly the engineer turned the light on the native’s naked feet
and there, standing out plainly in spite of the dirt and dust, was a
long scar that extended across the heel and partly up the side of his
foot toward the ankle. The wound looked exactly as if the man had
at one time stepped on a very sharp stone that had laid the flesh
open to the bone.
“By George, you’re right! He’s our man!” exclaimed the engineer
jubilantly. Then to the soldiers in Spanish he said:
“Hustle him off to the guardhouse, men, and put a double watch
over him, for he’s a traitor. I’ll pay a peso a day to the men who
watch him, but I’ll have the scoundrel shot who lets him get away.”
Without any ceremony the regulars jerked the big man to his feet
and marched him off down the street, Mr. Ryder and Jack following
directly behind with their revolvers cocked and ready for action. But
the heavy door to the prison pen had hardly been bolted behind the
rurale when the town was aroused by another sensation. From down
along the line of barbed wire fence came the sharp report of a rifle.
The first report was followed by two others in quick succession.
“What is it! An attack!” gasped Jack as he rushed forward with Mr.
Ryder. The sound of firing aroused every man in the camp and in an
instant half-clad soldiers and workmen came tumbling from barracks
hall and cottage.
“An attack! an attack!” was the cry they all uttered as they hurried
into the trenches.
But after the third shot the sentry’s guns were silent so long that
Mr. Ryder and Jack and Lieutenant Hernandez and Captain Alvarez
went to investigate.
“What was the trouble?” they demanded of the first soldier they
met.
“Shadows came along the fence. Three, four, five of them all came
to try and cut the wire. One dropped this,” said the sentry as he held
up an ugly looking machette.
“That’s mighty bad news,” said Mr. Ryder, “for it looks to me as if
the rebels are planning an attack. But we’ll fix these wire cutters to-
morrow night. In the meantime you fellows keep awake and on the
lookout until dawn.”
But when the news of the shadowy wire cutters was spread about
among the men there was little need for extra vigilance on the part
of the sentries, for every man in the village stayed up until daylight
discussing the possibilities of an attack. Indeed, the sun was just
rising as Jack and Mr. Ryder turned in for some much-needed sleep.
CHAPTER XV
IMPROVISED SEARCHLIGHTS

“Velly vell, on’y me no likee losee dlishe pans, Misler Lyder. Me no


velly much can usee pailes to washee dlishes in sometimes. Jus’
samee me no likee losee dlishe pan.”
Tom Why’s voice accompanied by the clatter of tin pans awoke
Jack next day, from a very sound sleep. The lad at first was
thoroughly mystified, for it was rarely that good natured Tom ever
objected to anything either he or Mr. Ryder did. It was evident,
however, from the pitch of the Chinaman’s voice that he was slightly
indignant.
“Me can no savvy leason to put holes in him dlish pan. Him alle
samee no glood then,” continued Tom.
“Well, I want to put wires through the bottom of the pans and
make searchlights out of them. What if your old pans are spoiled,
Tom. When the next train comes up from Mexico City I’ll have a
carload for you if you want them,” said Mr. Ryder.
“Me no wantee clarload. Me wantee tlu dlishe pans, and me no
wantee liars put thlu him bottom, too.”
“All right, Tom,” laughed the engineer; “you shall have two of the
finest dishpans south of the Rio Grande if you’ll only let me have
these two.”
“Velly vell, velly vell,” said Tom somewhat appeased at such an
attractive offer.
The conversation had done more than amuse Jack. It had made
him thoroughly curious, for he could not understand how Mr. Ryder
could make a searchlight out of a tin dishpan. He lost no time in
tumbling out of bed and dressing, and five minutes after the
engineer had left the house the youth was ready to follow him. Just
as Jack entered the main room, however, Tom Why came in at the
back door.
“Hello there, Tom, did Mr. Ryder confiscate your dishpans?” asked
the boy.
“No him no dloo lat. Him just takee him dlish plans. Him get Tlom
Why tlu flines likee clums to Melexeclo,” said Tom with a grin. Then
he added, “Allee samee Jack want him dlinner now?”
“Dinner?” exclaimed the boy, “why, what time is it? Well, by
George, if it isn’t three o’clock. I’ve slept nearly ten hours. How long
has Mr. Ryder been up?”
“Him alle samee come from him room an’ slay, ‘Tom, glet my
bleckflast!’ Then him look at him clock him slay, ‘Gleat Clats, him one
o’clock. Tom, glet me my dlinner!’” Tom tried to imitate the engineer
as he quoted Mr. Ryder’s remarks and the result made Jack laugh
heartily.
In a surprisingly short time the Chinaman had the table spread
and a steaming hot meal before the young American. But the lad
hurried every mouthful (much to Tom’s displeasure), for he was
eager to reach the plant and witness the operation of converting tin
dishpans into searchlights. Also, he was curious to know what had
transpired since dawn that morning.
When Jack reached the little machine shop on the north side of
the power plant he found Mr. Ryder in the center of a pile of wire,
pieces of iron pipe, electric light bulbs and all sorts of odds and
ends. The engineer was busily engaged with one of Tom’s precious
tin dishpans.
“Oh! there you are, I thought you were due to sleep all day,” said
the engineer banteringly as Jack arrived. “You are just in time to
witness an attempt to build a genuine spotlight out of the cook’s
most cherished possession.”
“I heard all about it when you were trying to persuade Tom to be
generous with his pans. What do you mean to do anyway?” said
Jack.
“Why, I intend to spring a little surprise on our wire-cutting friends
this evening if they should happen around, which I expect they will.
I’m going to put a cluster of electric bulbs in each of these tin
dishpans, and put them up on iron rods in position so that they will
sweep the line of barbed-wire defense. I’m going to keep them dark
until the sentries see the ‘shadows’ that visited us last night, then
I’m going to switch them on and have a firing party ready. Oh! the
wire cutters will receive an ideal reception, I’ll warrant. You see,
fairly bright tin shaped in this manner will magnify the light beam
from three to five times and that will throw a spotlight as far as
necessary. Tin is an excellent reflector for all ordinary purposes. With
the ten thirty-two candlepower lamps which I intend to use in each
cluster, I will get a beam of light 1600 candlepower intensity. Of
course that amounts to very little when compared with the huge
thirty-inch searchlight of ours that magnified a light several hundred
times.
“These searchlights will be operated by remote control; that is, a
wire will be run from the lights to the roof of the power station
where Phil will be on duty as usual. The moment he gets a signal
from the sentries he will throw on a switch which will connect with
both wires and the line of fence will be lighted from either direction
at once. The firing squad will be just beyond the lower trenches and
behind the lights, so that they will not be blinded by the sudden
glare. The bandits on the other hand will be surprised and made
temporarily blind by the sudden flash of light and before they get
away the riflemen will discourage any idea of future wire cutting
parties.”
“It sounds like a first-rate scheme,” said Jack appreciatively. Then
suddenly remembering the prisoner of the night before he queried:
“How is our friend, the rurale? Have you seen him to-day?”
“Yes, I’ve seen him,” said the engineer as he paused in his work of
fitting a group of lamp sockets inside the tin pan. “He’s a mighty
meek individual too just now. I guess his thoughts are on the trial
he’s to have to-morrow morning. The chief witnesses over-slept this
morning or he would probably have faced court-martial before this.
It was a lucky thing for him that we did oversleep too, for it gives
him a few hours longer to live at any rate.”
“What does he have to say for himself?” asked the lad.
“Well, in the first place, he’s the man whom Señor Yuai described.
He did live in the Indian village over the mountain, and he did cut
his foot by stepping on a machette. His name is Alfonso Perro. I
asked him why he was sneaking about the place last night and he
said that he had made arrangements with the peon who keeps the
cottage for the lineman to get some pulque for the troopers. Pulque
is the Mexican drink, you know. It is made from the sap of the
century plant or maquay plant and when properly prepared is a very
fiery and highly intoxicating drink. Don’t ever touch it, my boy, for it
has ruined the chance of more than one American who acquired a
taste for it. We do not allow it to be brought into Necaxa at all, but
the rurale says that every time the linemen’s peon goes to the
village he smuggles in several jugs of the stuff. Some was smuggled
in yesterday and the rurale said he was on his way to get it and
bring it back to the barracks when you captured him. Of course I
have had the peon arrested also. He too is in the guardhouse, but
he swears that he has never smuggled pulque into Necaxa.
“I accused Perro of having tampered with the machinery in the
plant from time to time and also of stealing my plans, and I must
say he is a very good actor, for he feigned surprise wonderfully well.
But when I told him how we set a trap for him and discovered that
he had a scar on his foot he looked even more surprised, and that
surprise was genuine. I think Captain Alvarez, of the rurales, is
decidedly angry over the whole affair and he is determined to have
the prisoner face a firing squad as soon as possible.”
“Well, I can’t help feeling a little sorry for the man,” said Jack, who
felt rather unhappy when he realized how much he had helped in
sending the man to his end.
“I feel sorry myself,” added Mr. Ryder, “and if he would only tell
the truth about the plans and give me some idea where they are I’d
do my utmost to save his life. However, the best that I could do
would be of little avail, I’m afraid, for Captain Alvarez takes charge
of all prisoners and the man’s fate is entirely in his hands.”
The two searchlights were completed late that afternoon, but Mr.
Ryder did not make an attempt to erect them until after dark, for as
he explained to Jack, “Those bandits may have lookouts stationed on
the mountains, and to have them see our new lights would knock
the little surprise party into a cocked hat.”
It required but a very little time to put the lamps in place, for the
engineer had fastened each tin pan to a section of iron pipe and this
was easily strapped to a tree at either end of the clearing in front of
the plant. The sentries were carefully coached that night before they
were sent to their post, and most of the men in the village as well as
the extra soldiers and rurales, gathered in the trenches to watch for
developments.
But hours of waiting under such strained conditions was far from
comfortable and after a while the men grew restive. In twos and
threes they began to leave for their cottages, quite disappointed that
nothing spectacular had happened. Jack, who was in the first trench,
began to grow tired of the suspense too. Indeed, he was just on the
point of going back to the cottage himself, when suddenly a rifle
shot rang out at one end of the clearing. This was followed by
another further up the line of fence and instantly Phil Underwood, on
the roof, jammed home the switch.
The flood of light that swept along the barricade revealed almost a
score of bandits, with machettes and big wire nippers. Some were
discovered in the very act of snipping strands of wire while others,
thoroughly frightened, were turning to flee, but they had scarcely
moved two steps before the roar of a dozen rifles burst forth.
Jack saw two men toss up their hands and pitch forward in the
grass. Another staggered a few steps, then he too fell in a limp
heap. Other shots rang out, but the rebels got beyond the range of
the improvised searchlights and were lost in the dark before any
others were brought down.
It all transpired so quickly that Jack could hardly believe his eyes.
He felt as if he had been looking at a motion picture of something
that had taken place in a far-off land. But he realized the horror of it
all when several soldiers crawled under the barbed wire fence and
picked up the three lifeless forms. Indeed, he was forced to turn
away, for the whole scene became very repulsive to him. The idea of
trapping human beings like rats and slaughtering them, was hideous.
But the other men laughed and joked over the occurrence exactly as
if they had but recently witnessed a performance at a theater.
CHAPTER XVI
A WARNING

“Hi there, Jack, is that you?” called Mr. Ryder as the lad entered
the cottage.
“Yes, but what on earth are you doing here with all the rumpus
down at the plant?”
“Oh, I’ve been here for the last hour or more. To tell you the truth,
my boy, I did not have the heart to remain and see the outcome. I
knew the trap would work; in fact, I was afraid it would work too
well. How many men did they kill, Jack?” There was a note of
anxiety in the engineer’s voice as he asked the question.
“Three,” replied the boy.
“Well, thank heavens it wasn’t more,” said Mr. Ryder somewhat
relieved. “The riflemen would have had no compunction if the
number had been thirty-three, but I have. It seems wicked and
inhuman to sacrifice three lives in order to teach the beggars a
lesson. It makes me very unhappy.”
Jack was glad to find that Mr. Ryder took this attitude in the
matter. If the truth were known he had secretly felt a little bitter
toward the engineer for concocting such a diabolical trap. But when
he saw how unhappy it had made the man his bitterness turned to
sympathy.
“It does seem mighty hard to kill three men in order to teach the
rest of them a lesson, but I suppose it was absolutely necessary for
our own safety,” said the youth in an effort to relieve the engineer’s
feelings.
“You are quite right, my lad. It is hard, but it had to be done.
Sometimes, you know, the lesson is almost as disagreeable to the
teacher as it is to the pupil. I hope to goodness we’ll have no more
of this slaughter, but the way the rebels are acting I am very much
afraid that we will be in for a real battle before the trouble is settled.
I sincerely hope I’m wrong.”
The engineer was sitting at the table in the center of the room, a
mass of blueprints, drawings and typewritten data spread out in
front of him. His shirt was open at the throat, for the evening was
very warm and his revolver and cartridge belt had been removed
and tossed carelessly on the table before him.
“What are all the plans?” queried Jack as he sat down opposite
the engineer.
“These are the original sketches and preliminary drawings from
which I worked out my lightning arrester,” replied Mr. Ryder. “It
begins to look as if the stolen papers weren’t going to turn up. Our
rurale with the scarred foot denies all knowledge of their
whereabouts, which means that he will never tell where they are,
even if he does happen to know, for a Mexican can be mighty
stubborn when he feels disposed that way. Under the circumstances,
I fancy I’ll have to dig a new set of blueprints out of these old plans.
“And that isn’t going to be the easiest work in the world, let me
tell you. I have paid very little attention to the preliminary papers
since I worked out the final plans and the consequence is many of
the more important sketches and formulas have disappeared. I am
mighty sorry that I did not make duplicate drawings before I sent
the plans to Drueryville. The worst feature of the whole thing is the
fact that I have not yet applied for patent rights either in this
country or the United States. I could not take this step until I had
secured Dr. Moorland’s formula, you know, because that was one of
the fundamental features of the new appliance. In that case
whoever has the plans can very easily apply for patents in his own
name and then all my work will have been for nothing. Indeed, if I
wanted to use my own invention after that I would probably be
forced to pay a royalty to some one else. That would be a fine how-
de-do, wouldn’t it?”
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!

ebookgate.com

You might also like