100% found this document useful (1 vote)
23 views54 pages

Computer Programming E. Balagurusamy download

The document provides information about various programming books authored by E. Balagurusamy, including titles on C programming, problem solving, and data structures. It also includes details about the author's background, his contributions to the field of computer science, and the structure of the book 'Computer Programming'. Additionally, it outlines the contents and chapters covered in the book, emphasizing programming concepts and methodologies.

Uploaded by

toliosariele
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
23 views54 pages

Computer Programming E. Balagurusamy download

The document provides information about various programming books authored by E. Balagurusamy, including titles on C programming, problem solving, and data structures. It also includes details about the author's background, his contributions to the field of computer science, and the structure of the book 'Computer Programming'. Additionally, it outlines the contents and chapters covered in the book, emphasizing programming concepts and methodologies.

Uploaded by

toliosariele
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

Computer Programming E.

Balagurusamy pdf
download

https://ebookmass.com/product/computer-programming-e-
balagurusamy/

Explore and download more ebooks at ebookmass.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmass.com
to discover even more!

Programming in C E. Balagurusamy

https://ebookmass.com/product/programming-in-c-e-balagurusamy/

Programming for Problem Solving E Balagurusamy

https://ebookmass.com/product/programming-for-problem-solving-e-
balagurusamy/

Problem Solving and Python Programming E. Balagurusamy

https://ebookmass.com/product/problem-solving-and-python-programming-
e-balagurusamy/

Programming in ANSI C 6th Edition E. Balagurusamy

https://ebookmass.com/product/programming-in-ansi-c-6th-edition-e-
balagurusamy/
Data Structures E. Balagurusamy

https://ebookmass.com/product/data-structures-e-balagurusamy/

The Art of Computer Programming, Volume 4B: Combinatorial


Algorithms, Part 2 Donald E. Knuth

https://ebookmass.com/product/the-art-of-computer-programming-
volume-4b-combinatorial-algorithms-part-2-donald-e-knuth/

The Art of Computer Programming - Combinatorial Algorithms


Donald Knuth

https://ebookmass.com/product/the-art-of-computer-programming-
combinatorial-algorithms-donald-knuth/

Sicurezza dei computer e delle reti 1st Edition W.


Stalling

https://ebookmass.com/product/sicurezza-dei-computer-e-delle-reti-1st-
edition-w-stalling/

Computer Science Illuminated

https://ebookmass.com/product/computer-science-illuminated/
As per
JNTU-Kakinada
Syllabus Regulation
2016

Computer
Programming
About the Author

E Balagurusamy, former Vice Chancellor, Anna University, Chennai and Member, Union Public Service
Commission, New Delhi, is currently the Chairman of EBG Foundation, Coimbatore. He is a teacher, trainer,
and consultant in the fields of Information Technology and Management. He holds an ME (Hons) in Electrical
Engineering and PhD in Systems Engineering from the Indian Institute of Technology (IIT) Roorkee. His
areas of interest include Object-Oriented Software Engineering, E-Governance: Technology Management,
Business Process Re-engineering, and Total Quality Management.
A prolific writer, he has authored a large number of research papers and several books. His best-selling
books, among others include:
∑ Programming in ANSI C, 7/e
∑ Fundamentals of Computers
∑ Computing Fundamentals and C Programming
∑ Programming in Java, 5/e
∑ Programming in BASIC, 3/e
∑ Programming in C#, 3/e
∑ Numerical Methods
∑ Reliability Engineering
∑ Introduction to Computing and Problem Solving using Python, 1e

A recipient of numerous honors and awards, E Balagurusamy has been listed in the Directory of Who's
Who of Intellectuals and in the Directory of Distinguished Leaders in Education.
As per
JNTU-Kakinada
Syllabus Regulation
2016

Computer
Programming

E Balagurusamy
Chairman
EBG Foundation
Coimbatore

McGraw Hill Education (India) Private Limited


CHENNAI

McGraw Hill Education Offices


Chennai 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
McGraw Hill Education (India) Private Limited

Published by McGraw Hill Education (India) Private Limited


444/1, Sri Ekambara Naicker Industrial Estate, Alapakkam, Porur, Chennai - 600 116

Computer Programming
Copyright © 2017 by McGraw Hill Education (India) 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,
McGraw Hill Education (India) Private Limited

Print Edition:
ISBN-13: 978-93-5260-388-6
ISBN-10: 93-5260-388-5

Managing Director: Kaushik Bellani


Director—Products (Higher Education and Professional): Vibha Mahajan
Manager—Product Development: Koyel Ghosh
Specialist—Product Development: Sachin Kumar
Head—Production (Higher Education and Professional): Satinder S Baveja
Assistant Manager—Production: Jagriti Kundu
AGM—Product Management (Higher Education and Professional): Shalini Jha
Manager—Product Management: Kartik Arora
General Manager—Production: Rajender P Ghansela
Manager—Production: Reji Kumar

Information contained in this work has been obtained by McGraw Hill Education (India), from sources believed to be reliable.
However, neither McGraw Hill Education (India) nor its authors guarantee the accuracy or completeness of any information
published herein, and neither McGraw Hill Education (India) 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 McGraw Hill Education
(India) 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 The Composers, 260, C.A. Apt., Paschim Vihar, New Delhi 110 063 and printed at

Cover Printer:

Visit us at: www.mheducation.co.in


Contents

Preface xiii
Roadmap to the Syllabus xvi

Chapter 1 Introduction to Computers and Programming 1.1—1.30


1.1 Introduction 1.1
1.2 Computer Systems 1.2
1.2.1 Input Devices 1.3
1.2.2 CPU 1.5
1.2.3 Output Devices 1.6
1.2.4 Memory 1.8
1.3 History of C 1.12
1.4 Data Types 1.13
1.4.1 Integer Types 1.14
1.4.2 Floating Point Types 1.15
1.4.3 Void Types 1.16
1.4.4 Character Types 1.16
1.5 Programming Languages 1.16
1.5.1 Machine Language (Low Level Languages) 1.16
1.5.2 Assembly Language (Symbolic Language) 1.16
1.5.3 High-Level Languages 1.18
1.6 Development of C Algorithms 1.19
1.6.1 Characteristics of Algorithms 1.20
1.6.2 Advantages of Algorithms 1.20
1.6.3 Disadvantages of Algorithms 1.20
1.7 Software Development Method 1.22
1.7.1 Analysing the Requirements 1.23
1.7.2 Feasibility Analysis 1.23
1.7.3 Creating the Design 1.24
1.7.4 Developing Code 1.24
1.7.5 Testing the Software 1.25
1.7.6 Deploying the Software 1.25
1.7.7 Maintaining the Software 1.25
1.8 Applying Software Development Method 1.25
Key Terms 1.27
Just Remember 1.28
Multiple Choice Questions 1.28
vi Contents

Answers 1.29
Review Questions 1.29

Chapter 2 Basics of C 2.1—2.90


2.1 Importance of C 2.1
2.2 Basic Structure of C Programs 2.1
2.3 Programming Style 2.2
2.4 Executing a ‘C’ Program 2.3
2.5 Sample Programs 2.4
2.5.1 Sample Program 1: Printing a Message 2.4
2.5.2 Sample Program 2: Adding Two Numbers 2.6
2.5.3 Sample Program 3: Interest Calculation 2.8
2.5.4 Sample Program 4: Use of Subroutines 2.10
2.5.5 Sample Program 5: Use of Math functions 2.10
2.6 C Character Set 2.12
2.6.1 Trigraph Characters 2.13
2.7 C Tokens 2.14
2.8 Keywords and Identifiers 2.14
2.9 Operators and Expressions 2.15
2.9.1 Arithmetic Operators 2.15
2.9.2 Relational Operators 2.18
2.9.3 Logical Operators 2.19
2.9.4 Assignment Operators 2.20
2.9.5 Increment and Decrement Operators 2.22
2.9.6 Conditional Operator 2.23
2.9.7 Bitwise Operators 2.25
2.9.8 Special Operators 2.25
2.9.9 Operator Precedence 2.27
2.9.10 Precedence of Arithmetic Operators 2.29
2.9.11 Some Computational Problems 2.30
2.9.12 Type Conversions in Expressions 2.31
2.9.13 Operator Precedence and Associativity 2.34
2.10 Constants 2.36
2.10.1 Integer Constants 2.37
2.10.2 Real Constants 2.38
2.10.3 Single Character Constants 2.38
2.10.4 String Constants 2.39
2.11 Variables 2.40
2.12 Declaration of Variables 2.41
2.12.1 Primary Type Declaration 2.41
2.12.2 User-defined Type Declaration 2.42
2.12.3 Declaration of Storage Class 2.43
2.12.4 Assigning Values to Variables 2.44
Contents vii

2.13 ANSI C Library Functions 2.50


2.14 Managing Input and Output Operations 2.53
2.14.1 Reading a Character 2.54
2.14.2 Writing a Character 2.56
2.14.3 Formatted Input 2.58
2.14.4 Points to Remember while Using scanf 2.65
2.14.5 Formatted Output 2.66
2.15 Case Studies 2.71
Key Terms 2.78
Just Remember 2.79
Multiple Choice Questions 2.80
Answers 2.84
Review Questions 2.84
Debugging Exercises 2.86
Programming Exercise 2.87

Chapter 3 Decision Making, Branching and Looping 3.1—3.70


3.1 Introduction 3.1
3.2 Decision Making with If Statement 3.1
3.2.1 Simple If Statement 3.2
3.2.2 The If.....Else Statement 3.6
3.2.3 Nesting of If....Else Statements 3.9
3.2.4 The Else If Ladder 3.11
3.3 Decision Making with Switch Statement 3.15
3.4 The ? : Operator 3.20
3.5 Decision Making with Goto Statement 3.22
3.6 Introduction to Looping Procedure 3.25
3.6.1 Sentinel Loops 3.26
3.7 The While Statement 3.27
3.8 The Do Statement 3.29
3.9 The For Statement 3.33
3.9.1 Simple ‘for’ Loops 3.33
3.9.2 Additional Features of For Loop 3.37
3.9.3 Nesting of For Loops 3.39
3.10 Jumps In Loops 3.43
3.10.1 Jumping Out of a Loop 3.43
3.11 Case Studies 3.45
Key Terms 3.56
Just Remember 3.57
Multiple Choice Questions 3.58
Answers 3.60
Review Questions 3.61
Debugging Exercises 3.65
Programming Exercises 3.66
viii Contents

Chapter 4 User-Defined Functions 4.1—4.52


4.1 Introduction 4.1
4.2 Need for User-Defined Functions 4.1
4.3 A Multi-Function Program 4.2
4.3.1 Modular Programming 4.4
4.4 Category of Functions 4.5
4.4.1 No Arguments and No Return Values 4.5
4.4.2 Arguments but No Return Values 4.7
4.4.3 Arguments with Return Values 4.10
4.4.4 No Arguments but Returns a Value 4.16
4.4.5 Functions that Return Multiple Values 4.16
4.4.6 Nesting of Functions 4.17
4.5 Elements of User-Defined Functions 4.19
4.6 Definition of Functions 4.19
4.6.1 Function Header 4.20
4.6.2 Name and Type 4.20
4.6.3 Formal Parameter List 4.20
4.6.4 Function Body 4.21
4.7 Return Values and their Types 4.21
4.8 Function Calls 4.22
4.8.1 Function Call 4.24
4.9 Function Declaration 4.24
4.9.1 Prototypes: Yes or No 4.25
4.9.2 Parameters Everywhere! 4.25
4.10 Recursion 4.26
4.10.1 Recursion versus Iteration 4.27
4.11 Passing Arrays to Functions 4.27
4.11.1 One-Dimensional Arrays 4.27
4.11.2 Two-Dimensional Arrays 4.31
4.12 Passing Strings to Functions 4.32
4.12.1 Pass by Value versus Pass by Pointers 4.32
4.13 The Scope, Visibility, and Lifetime of Variables 4.33
4.13.1 Automatic Variables 4.33
4.13.2 External Variables 4.35
4.13.3 External Declaration 4.37
4.13.4 Static Variables 4.39
4.13.5 Register Variables 4.40
4.14 Multifile Programs 4.42
4.15 Case Study 4.43
Key Terms 4.46
Just Remember 4.46
Multiple Choice Questions 4.47
Contents ix

Answers 4.48
Review Questions 4.49
Debugging Exercises 4.51
Programming Exercises 4.51

Chapter 5 Arrays 5.1—5.44


5.1 Introduction 5.1
5.1.1 Data Structures 5.2
5.2 One-Dimensional Arrays 5.2
5.3 Declaration of One-dimensional Arrays 5.3
5.4 Initialization of One-dimensional Arrays 5.6
5.4.1 Compile Time Initialization 5.6
5.4.2 Run Time Initialization 5.7
5.4.3 Searching and Sorting 5.11
5.5 Two-Dimensional Arrays 5.12
5.6 Initializing Two-Dimensional Arrays 5.16
5.6.1 Memory Layout 5.19
5.7 Multi-Dimensional Arrays 5.25
5.8 Dynamic Arrays 5.26
5.9 Case Studies 5.26
Key Terms 5.38
Just Remember 5.38
Multiple Choice Questions 5.39
Answers 5.40
Review Questions 5.40
Debugging Exercises 5.41
Programming Exercises 5.42

Chapter 6 Strings 6.1—6.34


6.1 Introduction 6.1
6.2 Declaring and Initializing String Variables 6.2
6.3 Reading Strings from Terminal 6.3
6.3.1 Using scanf Function 6.3
6.3.2 Reading a Line of Text 6.5
6.3.3 Using getchar and gets Functions 6.6
6.4 Writing Strings to Screen 6.11
6.4.1 Using printf Function 6.11
6.4.2 Using putchar and puts Functions 6.14
6.5 Arithmetic Operations on Characters 6.15
6.6 Putting Strings Together 6.16
6.7 Comparison of Two Strings 6.18
6.8 String-Handling Functions 6.18
6.8.1 strcat() Function 6.18
x Contents

6.8.2 strcmp() Function 6.19


6.8.3 strcpy() Function 6.20
6.8.4 strlen() Function 6.20
6.8.5 Other String Functions 6.22
6.9 Table of Strings 6.24
6.10 Case Studies 6.26
Key Terms 6.30
Just Remember 6.30
Multiple Choice Questions 6.30
Answers 6.31
Review Questions 6.31
Debugging Exercises 6.33
Programming Exercises 6.33

Chapter 7 Pointers 7.1—7.42


7.1 Introduction 7.1
7.2 Understanding Pointers 7.2
7.2.1 Underlying Concepts of Pointers 7.3
7.3 Initialization of Pointer Variables 7.3
7.3.1 Pointer Flexibility 7.4
7.4 Declaring Pointer Variables 7.5
7.4.1 Pointer Declaration Style 7.5
7.5 Accessing the Address of a Variable 7.6
7.6 Accessing a Variable Through its Pointer 7.8
7.7 Chain of Pointers 7.10
7.8 Pointer Expressions 7.11
7.9 Pointer Increments and Scale Factor 7.12
7.9.1 Rules of Pointer Operations 7.13
7.10 Pointers as Function Arguments 7.13
7.11 Functions Returning Pointers 7.16
7.12 Pointers to Functions 7.17
7.12.1 Compatibility and Casting 7.19
7.13 Pointers and Arrays 7.19
7.14 Pointers and Character Strings 7.23
7.15 Array of Pointers 7.25
7.16 Dynamic Memory Allocation 7.26
7.17 Allocating a Block of Memory: Malloc 7.27
7.18 Allocating Multiple Blocks of Memory: Calloc 7.29
7.19 Releasing the Used Space: Free 7.33
7.20 Case Studies 7.33
Key Terms 7.38
Just Remember 7.38
Multiple Choice Questions 7.39
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Contents xi

Answers 7.40
Review Questions 7.40
Debugging Exercises 7.42
Programming Exercise 7.42

Chapter 8 Structures and Unions 8.1—8.59


8.1 Introduction 8.1
8.2 Defining a Structure 8.1
8.3 Declaring Structure Variables 8.2
8.3.1 Accessing Structure Members 8.4
8.4 Structure Initialization 8.5
8.5 Arrays of Structures 8.8
8.5.1 Arrays Within Structures 8.11
8.5.2 Structures Within Structures 8.13
8.6 Structures and Functions 8.15
8.6.1 Passing Structure Through Pointers 8.17
8.6.2 Self Referential Structure 8.18
8.7 Pointers and Structures 8.18
8.8 Unions 8.21
8.9 Bit Fields 8.23
8.10 Typedef 8.25
8.11 Command Line Arguments 8.37
8.11.1 Application of Command Line Arguments 8.48
8.12 Case Study 8.50
Key Terms 8.53
Just Remember 8.53
Multiple Choice Questions 8.54
Answers 8.54
Review Questions 8.55
Debugging Exercises 8.57
Programming Exercise 8.58

Chapter 9 Data Files 9.1—9.22


9.1 Introduction 9.1
9.2 Defining and Opening a File 9.2
9.3 Closing a File 9.3
9.4 Input/Output Operations on Files 9.4
9.4.1 The getc and putc Functions 9.4
9.4.2 The getw and putw Functions 9.8
9.4.3 The fprintf and fscanf Functions 9.10
9.5 Error Handling During I/O Operations 9.12
9.6 Random Access to Files 9.14
Key Terms 9.20
xii Contents

Just Remember 9.20


Multiple Choice Questions 9.21
Answers 9.21
Review Questions 9.21
Debugging Exercise 9.22
Programming Exercise 9.22

Appendix 1 C99/C11 Features A1.1—A1.8


Solved Question Paper Nov-Dec 2015 (Set 1— Set 4) SQP1—SQP32
Solved Question Paper May 2016 (Set 1— Set 4) SQP1—SQP29
Preface

INTRODUCTION
Computers plays an increasing important role in today’s world and a sound knowledge of computers has
become indispensable for anyone who seeks employment not only in the area of IT but also in any other
field as well. Computer programming is dedicated to the understanding of computer language, and writing
and testing of programs that computers’ follow to perform their functions. The programs are created using
programming languages and C is the most prevalent, efficient and compact programming language. C
combines the features of a high-level language with the elements of the assembler and is thus close to both
man and machine. The growth of C during the last few years has been phenomenal. It has emerged as the
language of choice for most applications due to its speed, portability and compactness of code. Thus, many
institutions and universities in India have introduced a subject covering Computer Programming.
This book is specially designed for first-year students of Jawaharlal Nehru Technological University
Kakinada (JNTU K) and would enable them to master the necessary skills for programming with C language.
The text has been infused with numerous examples and case studies to empower the learner. Furthermore, the
book also covers design and implementation aspect of data structures using standard ANSI C programming
language.

SIGNIFICANT FEATURES
∑ New! Completely in sync with the syllabus of JNTU Kakinada (2016 Regulation)
∑ New! Incorporates all the features of ANSI C that are essential for a C programmer.
∑ New! Solutions to latest 2015 (Nov/Dec) and 2016 (May) JNTU Kakinada question paper is placed
at the end of the book (All 4 sets)
∑ New! 149 Multiple Choice Questions incorporated at the end of each chapters help students tests
their conceptual understanding of the subject
∑ 22 Case Studies in relevant chapters with stepwise solution to demonstrate real-life applications
∑ New! Updated information on C99/C11 features
∑ New! Topics like ANSI C library functions, Negation, Swapping Values, Recursion v/s Iteration are
covered in detail
∑ Learning by example approach ensures smooth and successful transition from a learner to a skilled
C programmer
∑ Enhanced student-friendly chapter design including Outline, Introduction, Section-end Solved
Programs, Case Studies, Key Terms, Just Remember, Multiple Choice Questions, Review Questions,
Debugging Exercises, Programming Exercises
∑ Special box feature highlighting supplementary information that complements the text.
xiv Preface

PEDAGOGICAL FEATURES
∑ 134 Solved C Programs demonstrate the general principles of good programming style
∑ 171 Review Questions helps in testing conceptual understanding
∑ 28 Debugging Exercise helps in participating coding contests
∑ 179 Programming Exercises simulate interest to practice programming applications

CHAPTER ORGANIZATION
The content is spread across 9 chapters. Chapter 1 introduces computer systems, programming languages
and environment, software development method, and algorithms. Chapter 2 gives an overview of C and
explaining the keywords, identifiers, constants, variables, data types and various case studies on these.
Chapters 3 comprises of decision-making, branching and looping methods. Chapter 4 covers the functions
which are used in C language. Chapter 5 focuses on arrays while Chapter 6 deals with strings. Different
types of pointers and its types are discussed in Chapter 7. Chapter 8 presents structures and unions while
Chapter 9 covers file types and their management. Appendix 1 covers C99/C11 features in detail. In addition
to all this, Solved Question Papers of Nov/Dec 2015 (4 sets) and May 2016 (4 sets) are also given in this
book.

CD RESOURCES
The supplementary CD provided along with the book would help the students master programming language
and write their own programs using Computer programming concepts and data structures. The CD comprises
of the following resources:
∑ New! 2012, 2013, 2014, Jan/Feb 2015 solved question papers
∑ New! Lab Programs as per the new syllabus
∑ Two major programming projects—Inventory and Record Entry & two mini projects—Linked List
and Matrix Multiplication
∑ 100 Programming Exercises and 200 Objective Type Questions aligned as per the new syllabus
∑ 5 Solved Model Question Papers
∑ 79 Additional Solved Programs
∑ Additional content on Matrix Operation

ACKNOWLEDGEMENTS
A number of reviewers took pains to provide valuable feedback for the book. We are grateful to all of them
and their names are mentioned as follows:
S. Krishna Rao Sir CR Reddy College of Engineering, Eluru, Andhra Pradesh
Narasimha Rao Kandula Vishnu Institute of Technology, Bhimavaram, Andhra Pradesh
K. Phani Babu, Chundru Raja Ramesh Sri Vasavi Engineering College, Tadepalligudem, Andhra
Pradesh
Preface xv

Rama Rao Adimalla Lendi Institute of Engineering and Technology, Jonnada,


Andhra Pradesh
S. Rama Sree Aditya Engineering College, Peddapuram, Andhra Pradesh
M V S S Nagendranath Sasi Institute of Technology & Engineering, Tadepalligudem,
Andhra Pradesh
S. Satyanarayana Raghu Engineering College, Dakamarri, Andhra Pradesh
S C Satapathy Anil Neerukonda Institute of Technology and Sciences,
Visakhapatnam, Andhra Pradesh
Ch Vijaya Kumar DVR & Dr. HS MIC College of Technology, Kanchikacherla,
Andhra Pradesh

E Balagurusamy

Publisher’s Note
McGraw Hill Education (India) invites suggestions and comments, all of which can be sent to
[email protected] (kindly mention the title and author name in the subject line).
Piracy-related issues may also be reported.
Roadmap to the Syllabus

Computer Programming
Revised Course from Academic Year 2016-2017

Unit 1: History and Hardware—Computer hardware, Bits and bytes, Components, Programming
Languages—machine language, assembly language, low-level and high-level languages, procedural and
object-oriented languages, Application and system software, Development of C algorithms, Software
development process

Go to
Chapter 1: Introduction to Computers and Programming

Unit 2: Introduction to C programming, Identifiers, main () function, printf () function, Programming


style, Indentation, Comments, Data types, Arithmetic operations, Expression types, Variables and
declarations, Negation, Operator precedence and associativity, Declaration statements, Initialization
assignment, Implicit type conversions, Explicit type conversions, Assignment variations, Mathematical
library functions, Interactive input, Formatted output, Format modifiers

Go to
Chapter 1: Introduction to Computers and Programming
Chapter 2: Basics of C

Unit 3: Control flow-relational expressions—logical operators, Selection—if-else statement—nested if,


examples—multi-way selection—switch—else-if, examples, Repetition—basic loop structures, Pretest
and post-test loops, Counter-controlled and condition-controlled loops, While statement, For statement,
Nested loops, do-while statement

Go to
Chapter 3: Decision Making, Branching and Looping
Roadmap to the Syllabus xvii

Unit 4: Modular programming: function and parameter declarations, Returning a value, Functions with
empty parameter lists, Variable scope, Variable storage class, Local variable storage classes, Global
variable storage classes, Pass by reference, Passing addresses to a function, Storing addresses variables,
Using addresses, Declaring and using pointers, Passing addresses to a function, Swapping values,
Recursion—mathematical recursion—recursion versus iteration.

Go to
Chapter 4: User-Defined Functions

Unit 5: One-dimensional arrays, Input and output of array values, Array initialization, Arrays as function
arguments, Two-dimensional arrays, Larger dimensional arrays—matrices, String fundamentals, Library
functions, String input and output, String processing

Go to
Chapter 5: Arrays
Chapter 6: Strings

Unit 6: Pointers—concept of a pointer, Initialisation of pointer variables, Pointers as function arguments,


Passing by address, Dangling memory, Address arithmetic, Character pointers and Functions, Pointers to
pointers, Dynamic memory management functions, Command line arguments
Structures—derived types, Structures declaration, Initialization of structures, Accessing structures,
Nested structures, Arrays of structures, structures and functions, Pointers to structures, self-referential
structures, Unions, typedef, bit-fields
Declaring, Opening, and Closing file streams, Reading from and Writing to text files, Random file
access

Go to
Chapter 7: Pointers
Chapter 8: Structures and Unions
Chapter 9: Data Files
Introduction to Computers
1 and Programming

CHAPTER OUTLINE
1.1 Introduction 1.4 Data Types 1.7 Software Development Method
1.2 Computer Systems 1.5 Programming Languages 1.8 Applying Software
1.3 History of C 1.6 Development of C Algorithms Development Method

1.1 INTRODUCTION
The term computer is derived from the word
compute. A computer is an electronic device Data INPUT PROCESS
OUTPUT
Information
that takes data and instructions as an input
from the user, processes data, and provides
useful information known as output. This
cycle of operation of a computer is known as Instructions
the input–process–output cycle and is shown Fig. 1.1 Input–process–output concept
in Fig. 1.1. The electronic device is known as
hardware and the set of instructions is known as software.
A computer consists of various components that function as an integrated system to perform computational
tasks. These components include the following:
Central Processing Unit (CPU) It is the brain of the computer that is responsible for controlling
and executing program instructions.
Monitor It is a display screen, which shows information in visual form.
Keyboard and Mouse These are the peripheral devices used by the computer for receiving inputs
from the user.
Figure 1.2 shows the various components of a computer.
The unique capabilities and characteristics of a computer have made it very popular among its various
users, including engineers, managers, accountants, teachers, students, etc.
Some of the key characteristics of a modern digital computer include, among others the following:
Speed The computer is a fast electronic device that can solve large and complex problems in few
seconds. The speed of a computer generally depends upon its hardware configuration.
Storage capacity A computer can store huge amounts of data in many different formats. The storage
area of a computer system is generally divided into two categories, main memory and secondary storage.
1.2 Computer Programming

Monitor
CPU

Keyboard

Mouse

Fig. 1.2 Components of a computer

Accuracy A computer carries out calculations with great accuracy. The accuracy achieved by a
computer depends upon its hardware configuration and the specified instructions.
Reliability A computer produces results with no error. Most of the computer-generated errors are
in actuality human errors that are instigated by the user itself. Therefore, computers are regarded as
quite trustworthy machines.
Versatility Computers are versatile machines. They can perform varied tasks and can be used for
many different purposes.
Diligence Computers can perform repetitive calculations any number of times with the same level
of accuracy.
These capabilities of computers have enabled us to use them for a variety of tasks. Application areas may
broadly be classified into the following major categories.
1. Data processing (commercial use)
2. Numerical computing (scientific use)
3. Text (word) processing (office and educational use)
4. Message communication (e-mail)
5. Image processing (animation and industrial use)
6. Voice recognition (multimedia)

1.2 COMPUTER SYSTEMS


A computer system comprises of hardware and software components. Hardware refers to the physical
parts of the computer system and software is the set of instructions or programs that are necessary for the
functioning of a computer to perform certain tasks. Hardware includes the following components:
Input devices They are used for accepting the data on which the operations are to be performed.
The examples of input devices are keyboard, mouse and track ball.
Processor Also known as CPU, it is used to perform the calculations and information processing on
the data that is entered through the input device.
Output devices They are used for providing the output of a program that is obtained after performing
the operations specified in a program. The examples of output devices are monitor and printer.
Memory It is used for storing the input data as well as the output of a program that is obtained
after performing the operations specified in a program. Memory can be primary memory as well
as secondary memory. Primary memory includes Random Access Memory (RAM) and secondary
memory includes hard disks and floppy disks.
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Exploring the Variety of Random
Documents with Different Content
27
iv

WHERE TIGERS FLOURISH


1. TIGERS IN THE AIR

I
N 1895, while doing Forest Settlement work in the Upper Chindwin
district of Upper Burma, I lived in an atmosphere of tigers. Hardly a
day passed without seeing or hearing some sign of them. It was a
great disappointment, both to my companion and colleague,
Mr Bruce, Deputy Conservator of Forests, and to myself to finish our
long journeyings without a single encounter. We spared no pains to
compass one; but we were going fast, with a troop of elephants for
baggage, and were being met at many points by crowds of men on
business; so that it was not a surprise, although it was a
disappointment, to miss seeing “our friend the enemy” at home. The
tiger, as we were well aware, might say with Tommy Atkins that he is
fighting for meat and not for glory; and when, in seeking dinner, he
caught
28
sight of an enemy that seemed dangerous, he was bound to
behave like Brer Rabbit, to lie low and say nothing. The jungle was
continuous, and in parts so thick that he might at times have been
lying within spitting distance and remained unseen and unsuspected.
No doubt the tigers saw us many a time, though we saw none of
them. The villagers, in order to feel safe, went about in twos and
threes or in larger parties, like London policemen in the slums.
Whenever two parties met, they discussed the latest news of tigers.
Among a crowd of items, I well recollect that both Mr Dickinson, the
Conservator, and Mr Bruce had much to tell me about the fine
performances of C. W. Allan of their department that year there, and
of his experiences in 1894.
As “half a word fixed, upon or near the spot, is worth a cart-load of
recollection,” according to authority, I have persuaded Mr Allan, now
Deputy Conservator at Henzada, to let me publish a few extracts from
his Shikar-Book, a contemporary record. It may be as well to mention
that, knowing him well, I believe what he wrote as firmly as if I had
seen it all myself, and that it tallies completely with what was told me
in 1895.

29
2. TIGERS VICTORIOUS
[Extract from the “Shikar-Book” of C. W. Allan]

“D
URING the month of March, 1894, I had to go out into the Kubo
Valley, in the Kindat Forest Division, Upper Chindwin, to do the
demarcation of the Khanpat Reserve. On the 16th I arrived at
the village of Thinzin and halted there the 17th to collect coolies to do
the work, which I found to be no easy matter. On inquiring the
reason, I was told that there was a man-eater tiger in that part of the
forest, and that it had killed three men within the last six weeks, and
that people were afraid to go anywhere near the forest. This was very
unpleasant news. However, the work had to be done and men must
be found, so I ordered the Thugyi (village headman) to hurry up and
get them, and told him that there was nothing to be afraid of as I had
five guns with me and could look after the men.
“On questioning the Thugyi about the man-eater, he informed me that
the first man killed was a mahout (elephant driver) employed by the
Bombay Burma Trading Corporation. This man was carried off in the
Pyoungbok stream. He and another man had gone out to look for
their
30
elephant, which had been fettered and turned out to graze. And
it was whilst following up the drag of the chain that the tiger sprang
on to the mahout who was leading, and was carrying a gun on his
shoulder, and carried him off. The man who was following the mahout
was carrying a dah (big knife) in his hand, and was just behind the
mahout. He was so taken aback that he could do nothing to save his
companion, so ran away and informed some other men who were
encamped close by. But they were too frightened to go and look for
the mahout. And it would not have been much good their going, for
by the time they got to the place the tiger would have finished his
meal and moved off.
“The second man carried off was also a mahout in the service of the
B. B. T. C. He was also carried off much in the same manner from the
Nansawin stream, and within ten days of the date the first man was
killed. This mahout was out with a party of some six men hunting for
fish in the stream, when the tiger sprang on to him from the bank and
carried him off before the other men could do anything. They too did
not attempt to save their comrade, but made tracks out of that
stream as fast as their legs could carry them.
“The
31 third man killed was a Burmese policeman. A party of six
constables were out on patrol, and had camped for the night under a
large teak tree between the Pyoungbok and Nansawin streams. About
four o’clock in the morning one of the men had got up and lit a fire,
and put on a pot of rice to boil for their breakfast, and had lain down
again beside the other men, intending to have another forty winks. He
had barely laid himself down when a tiger sneaked up behind the tree
they were sleeping under and seized the end man by the waist and
carried him off. The poor man shouted for all he was worth, ‘Shoot,
shoot, the tiger is carrying me off.’ This roused the others and they
picked up their guns and tried to shoot, but the powder or caps being
damp, the charges would not go off. They, however, put on fresh caps
and eventually got the guns to shoot. After this they fired several
shots and shouted, but the man’s cries had stopped, so they judged
that he must have been killed.
“The constables waited at their camp till daylight, and then went off
to the camp of some Burmese elephant drivers, which was about
three miles off, and made them collect their elephants, some
seventeen in number, and then returned and looked for their
comrade. They found the remains within a couple of hundred yards of
their
32 night’s camp. The tiger had finished its meal and had gone off.
The Thugyi informed me that although several shots had been fired in
the direction the tiger had gone it was not frightened, and sat there
and finished its meal.
“Hearing all this, I did not wonder at the men not wanting to go into
the forest. However, the work had to be done and go I must. Though
I must admit I did not quite appreciate the job.”

3. WORKING ALONGSIDE

“O
N the morning of the 18th March some twenty men turned up,
and the Thugyi informed me that the others would follow. So I
made a move and got as far as the Khanpat stream, where I
halted for a bit and had breakfast and then moved on again. It was
my intention to make the Pyoungbok camp that day, as I was told it
had a fence round it, made by the patrols to keep out the tiger. But
the coolies would not move fast enough, so I camped on the
Nanpalon stream.
“After seeing the camp pitched and everything in place, I told my
clerk to make all the men stay together, and not to let any men go
about
33 the forest in ones and twos, for fear of the tiger. I also told him
to have a big fire burning and to keep a watch of five men at the fire
and to relieve them every two hours, and to call me in case of an
alarm.
“I turned into bed at about nine o’clock, and had not been in bed ten
minutes when the clerk came and called me, saying the tiger had
come. I jumped out of bed, and taking my rifle ran out. The men at
the fire told me that a pony tied near them began to get very restless,
and kept looking towards the stream, so they got up and looked, and
saw the tiger not twenty paces off, ready to rush at them. I asked
where it had gone to on being found out. They replied that it had
gone down into the stream.
“Whilst I was talking to the men, one man, who was looking in the
direction of the stream, said, ‘Look, sir, there it is, going up the bank,’
and sure enough there it was, about seventy yards off, going across
the bed of the stream. I had a shot and it sprang up the bank, and
just as it was disappearing I fired a second shot. All the men said I
had hit it, and Maung Kyaw Nya, my forester, was for going and
looking for blood, but I thought this too dangerous and would not let
him
34 go. The next morning we got up early and went and had a look at
the place where the tiger had been standing when I fired at it. I found
where both the bullets had struck the ground. They were both clean
misses, and had struck below the tiger and between its legs.”

(N.B.—Mr Allan was and is one of the best hunters in Burma; but, in
firing in the dark, one cannot see one’s sights, and so the best of
shots makes misses.—D. W.)

“For the next three days nothing happened and the coolies seemed to
have got over their fright and were working well.
“On the 23rd I moved camp to a place on the Nansawin stream. The
forest there was very dense and I did not at all like the idea of
camping there, but as that was the only place where there was water,
I had a place cleared and pitched my tent, and then went out to
inspect the work. I gave orders to Maung Kyaw Nya to go ahead and
pick out the way the line of demarcation should go in, and also to see
how far the Thonhmwason” (that is, Three-Waters-Meeting, a
camping-place where three streams met) “was from my camp of that
day.
“At 3 p.m. a man came to me from the camp and said that Mg. Kyaw
Nya
35 had returned, as he had been chased by a tiger. On my return to
camp in the evening I sent for Kyaw Nya and questioned him as to
why he had not carried out my order. He replied that he and two
other men were going along the foot of the hill following the
boundary, when they came on to a half-eaten sambur (big deer).
They were going to take the flesh and bring it to camp for their
dinner, when they heard a rustling in the leaves, and on looking round
saw a tiger coming to see what they wanted with its dinner. The men,
seeing the tiger coming, dropped the sambur and went for all they
were worth, till they got out into the bed of the stream, and then
came down it to my camp.
“I thought the men were afraid to go out by themselves to locate the
boundary, and had invented the yarn about the tiger. Mg. Kyaw Nya
said, ‘If you do not believe me, sir, I will show you the place.’
“On the morning of the 25th I went out with Mg. Kyaw Nya and three
or four men, and they took me to the place where the tiger’s kill had
been, and sure enough there had been a kill there, but it had been
finished off during the night and there was nothing but the skull and
feet left. On my return to camp I had tea, and was thinking of tying
out a goat and sitting up for the tiger, but I did not like the idea of
having
36 to get off the machan (platform made in a tree) and come
back to the tent in the dark, so I gave it up.”

(Another objection, fatal to this plan, was that the men would have
been afraid to stay in the camp at night by themselves.—D. W.)

“About 4 p.m. the men were returning from work, when I heard a
great shouting not far from camp, so went out in the direction and
met them returning. The forester in charge informed me that a tiger
had charged out at the line of men and had tried to take one from the
centre, and that the man had thrown his dah (big knife) at the beast,
on which it bolted back into the grass.”

4. AT VERY CLOSE QUARTERS

“O
N seeing that the tiger was round our camp I took extra
precautions and made all the men stop in one place just
behind my tent; and gave orders to my Indian servants to have
their dinner early, and to sleep with the Burmese coolies. My cook, an
Indian, would not stop near the Burmans, though told to do so
several times. He had his kitchen fire just in front of my tent.
However, I told him he must sleep with the other men. The other
Indians
37 also told him not to be a fool and stay away by himself. To
them he replied that he was not afraid, and that if it was his fate the
tiger would have him. He said, ‘If it takes me, it will be a case of one
crunch and all will be over,’ and this is just what happened.
“I was having dinner early, before it got quite dark, so as to get the
men together. The cook had given me my soup and had cleared the
plate and put a roast fowl before me, and had gone back to the fire
and was standing with a knife in his hand watching the pudding on
the fire.
“I was just carving the chicken, when I heard the cook give a
frightened cry, and on looking up I saw the tiger spring on to the
cook. In jumping up I upset the table and the lamp on it, also a glass
of beer that had just been poured out for me, and ran out shouting at
the tiger, and threw my table knife at it. My dogs, two terriers and a
spaniel, were sitting by my table, and jumped up and ran after the
tiger with me and attacked it. One terrier and the spaniel were killed
on the spot, and the other dog got away. In spite of this the tiger
went off with the cook. I thought the tiger had got the cook by the
back, but the sweeper who was standing close by with my goats”
(that is to say, had been there when the tiger came), “said it had got
him by the head, and so it turned out to be the case.
“On
38 hearing me shout, the sweeper ran into the tent and got my rifle
and cartridges and handed them to me. I put in a cartridge and fired
in the direction the tiger had gone, and this had the effect of making
him drop the cook, but we did not know it at the time as no one
would venture into the forest to look for him. This of course upset
everyone in camp, and all huddled round my tent as close as they
could and shouted and beat tins all night. No one would even go to
replenish the fire unless I went with them, though it was not three
yards from my tent. All that night the tiger kept moving round the
tent and I kept it off by firing shots whenever we heard it walking in
the leaves and saw its eyes shining like live coals in the dark.”
Here it may be noted that the eyes of a tiger, shining through the
blackness of the utter dark, are a phenomenon hard to forget, if once
you see them. In this instance, whatever strange light shone in them
may have been intensified by the glare of the camp-fire reflected in
those glistening optics. But no such addition was possible in another
case credibly reported to me and of more recent date in the extreme
north of Burma. A tiger ventured into the sepoy lines one night, and
entering
39 the open door of a hut, it killed and carried away a man
asleep in bed. His comrades chased and mobbed the beast, which
dropped the corpse and escaped. The sepoys, taking counsel
together, put out the lights and hushed all noises, as if everyone was
asleep; and in fact they were back in their huts, and the door of the
dead man’s dwelling stood open as before. Only, in ambush, below or
beside the bed, in a dark corner, a brave man was waiting, rifle ready;
and the tiger did come back to that identical door that night, and was
shot, exactly as the sepoys had hoped. What lingers in the memory
best, of all the details of that adventure, is that the man who lay in
wait told a magistrate, who told me, that when the tiger came, all he
saw was “the eyes in the doorway, shining into the room like two
coloured lamps, filling the room with tinted light.” So he felt that
hiding was impossible and “banged away.”
One other remark may be intercalated, to let readers realise what is
what. Even to men of experience in tiger attacks, the swift
suddenness of events is a continual surprise. The tiger practises
“surprise tactics,” and his attack often is, and always is when he can
manage it, like a railway collision—it takes long to tell, but only a few
seconds to happen.
Let us now return to Mr Allan’s journal.

“Early
40 next morning, as soon as it was light enough to see, I started
to look for the body of the cook, and found it not ten paces from
where he had been cooking. The jungle, as I said before, was very
thick, so we could not see it at night.”
(The tiger must have dropped the corpse when Mr Allan fired. He had
therefore lost his supper. Probably enough that was why he continued
prowling round.—D. W.)

“The tiger had caught the cook by the head as the sweeper had said,
for one fang had gone into his right eye and had knocked it out,
another had gone into his throat just below the chin, and two had
gone into the skull and neck at the back. So it must have taken the
whole head into its mouth, for it was a pulp with the brains coming
out.
“We dug a shallow grave for the poor old cook and buried him, and
then left that forest as fast as the men could lay legs to the ground,
for nothing would induce them to stop another hour.... They yelled
and shouted till they got right clear of the forest.
“In leaving the forest no one wanted to be the last in the line for fear
of being taken from the back, so I brought up the rear.”

It41 only remains to be added that in 1895, though the tigers “remained
as usual,” Mr Allan finished the demarcation work so tragically
interrupted, and even took his wife to see the grave of the cook.

5. THE CHARGE OF THE TIGRESS

C
OMING to 1909, there is an episode in his Shikar-Book about a
tigress, which for various reasons may be transcribed:—

“... 14th April.—I started up to inspect the Banbwebin fire line ...
accompanied by my wife ... an Indian and two Burmans.... After we
had gone about five miles up the ... path, ... we heard bamboos being
broken. The Burmans said there must be a herd of wild elephants
feeding on the flowered bamboos. I thought they might possibly be
bison or a rhinoceros, so walked on to see what they really were. The
Indian was walking ahead of me, and I was following, looking down
the side of the hill from which the sound of the bamboos being
broken came, when Barhan, the Indian peon, stopped and said ‘Bag’
(tiger). I looked up and saw the tiger crossing the path about sixty
paces ahead of me, so ... had a quick shot at it. On which it turned
round
42 and came down the hill straight at me.... My wife, who was just
behind me, on seeing it come down the hill, called out, ‘It is coming.’
... It came on, and when less than thirty paces from me I fired the
second barrel and knocked it over. After receiving the shot it fell and
lay on the ground, trying to drag itself towards us.... It put its head
up and snarled and showed its teeth.... The Burmans, who were very
excited, kept on saying, ‘Give it another shot quick, or it will get up
and do for us.’ So after a bit I put in another cartridge and walked up
a few paces and gave it a bullet in the chest and finished it off.
“After giving it a shot in the chest I walked round and got above it,
and then approached cautiously with my gun at the ready to give it
another shot if necessary; but after throwing a clod or two of earth at
it, and finding that it did not move, I walked up and pulled its tail, and
when I found that it was dead I called out to my wife, who was close
by all the time, and she came up.
“We found it to be a tigress ... measuring eight feet and five inches as
she lay.... The first shot had missed and the second ... caught her at
the point of the shoulder. On looking at my gun, I found that the 200
yards
43 leaf sight had got pushed up, and that made me shoot high. I
was carrying the gun in my right hand, but holding it across my back,
and in pulling it forward in a hurry, the leaf sight had got pushed up,
and I did not notice it in the excitement of the moment....
“Maung Nita, one of the Burmans who was with me, said, ‘Sir, if you
had not finished her with the second shot we would all have been
lying kicking on the ground.’
“As three men were not able to lift her, my wife rode back to our
camp and called other eight men, and they slung her on poles and
carried her into camp.
“On dissecting the tigress, I found that she had nothing in her
stomach and appeared to have had no food for some time. She was
evidently out shikaring (hunting), and was after the animals that I
heard breaking bamboos.” ...

In a private letter to me at the time, Mr Allan wrote:—


“... Had I missed the second shot she would have had us.... She was
very angry. She was hungry and meant business. On opening her we
found that she ... had evidently not had a meal for some days.” ...
This illustrates a truth which is often forgotten by us. The big beasts
live
44 from hand to mouth, like improvident working men. A dog may
bury a bone, a tiger return to a kill, and a leopard has been known to
put half a corpse or an unfinished bit of venison up a tree for security.
But beyond the next meal they never look. It is only the insects of the
universe, like ants and bees, or such animals as squirrels, that
practise thrift. Hence arose the Jewish proverb about considering the
ways of the ant in order to be wise. There is no such lesson to be
learned from the cat.
One can be sorry for the tigress all the same. Think of her empty
stomach, and perhaps hungry cubs in her lair; and then this big,
strong Englishman, with his diabolical machinery in his hand,
molesting her as she was stalking the wild cattle. “She meant
business,” said he. Of course she did. Did anyone think she was
hunting for amusement?
No matter now! Her body lies inert enough, a subject for their
inquisitive knives to her indifferent.
Put yourself in the skin of that tigress, if you can. Think what a
gunshot means to a wild beast, and consider how, when fired at, she
“faced the music” in the real sense of that phrase, and went “straight
at the guns,” as gallantly as the Light Brigade at Balaklava. As even
the
45 enemy notes—“After receiving the shot, _it fell and lay on the
ground, trying to drag itself towards us.... It put its head up and
snarled and showed its teeth._” ... Was she not like the glorious
Englishman, who, when his legs were cut away, still fought upon his
stumps? Did any hero of Homer’s ever surpass that sorely-stricken
tigress? Could any living creature have done more? And yet there are
men to be found who call the big cats cowards! I never heard
Mr Allan do that, nor any other man of sense who knew them well at
first hand.
No wonder tigers flourished in the days of old. It is the invention of
gunpowder, and then of breechloaders, that has handicapped them
hopelessly. The long guerilla war between them and us has lasted for
scores of millenniums; but the end is now in sight. Let us not libel the
brave that are doomed to disappear. Let us not rail at the conquered.
If they were fierce and strong, they were not cruel. As Nature made
them, so they filled their function. They came, and chased, and
conquered, impelled by hunger: and now that their hour has come
they are going away. The day is at hand when the big wild cats shall
all be as completely extinct as the vanished giants that wallowed in
the primeval slime.
46
v

THE GIRL AND THE TIGRESS

T
HIS is a story that has been often told; and I confess I did not
believe it when I heard it in 1895, in the district where it
happened. Long afterwards, in 1908, Mr G. Tilly, who had been
the District Superintendent of Police on the spot at the time, told me
he held a local inquiry, and was so completely satisfied of the truth of
it that he recommended the payment of a reward of R100 to the girl,
and the Deputy Commissioner and the Commissioner agreed with
him, and the Chief Commissioner of Burma sanctioned the reward,
which was paid. In the absence of any motive for rash credulity on
the part of these officers, this might seem enough; but I happened to
be acquainted with Mr Grant Brown, who is now the Deputy
Commissioner of that district, called the Upper Chindwin, and wrote to
him about it. He replied on 21/2/09: “... I remembered the incident
quite well as told in the Rangoon Gazette, and should have included it
in47 my article on Burmese women if I had been able to remember
more of the details; but I had no idea that it took place in this district.
Curiously enough, the very first person I asked was the headman of
the village where the thing happened. He could give me no details
beyond those you mention.... The heroine is dead, and as I thought I
was sure to find an account of what happened in the record-room I
did not make further inquiries. A search has been made, however,
without result....”
The “article” mentioned is Mr Grant Brown’s article in The Women of
all Nations, by Messrs Joyce & Thomas, published by the Messrs
Cassell lately.
Failing to find the record of the original inquiry held by Mr Tilly, which
had perished, as a thing no longer needed, in a periodical destruction
of papers, Mr Grant Brown had a new inquiry held, and the vernacular
record of it is now before me. I sent a set of interrogatories, which
have been answered by Ma Shway U, an eye-witness, and the head
man of the village and another man, who were soon on the scene,
measured the tigress and did everything else that needed to be done.
None of these persons has any motive for misstatement, and the
chance
48 of mistake is infinitesimal. That time has not altered their
stories I can myself testify, for what they say tallies with what I was
told in 1895.
Readers can now see how my doubts have been removed, and must
be impatient to know what it was that I was so slow to believe. As
Mr Tilly tells me the newspapers merely gave more or less
abbreviated versions of his report, I have not referred to them.
The scene was Seiktha village on the Chindwin, an Upper Burman
tributary of the Irrawaddy, in one of the districts that form the
southern fringe of the mountains between Burma and Assam. One
day in 1894 three nut-brown girls set out from Seiktha to cut firewood
in the forest, making for a likely place they knew, a little south-east of
their village. They carried one or two heavy knives or choppers, like
butchers’ cleavers, such as are common in Burman houses.
Now if there had only been a man with them, or even a big boy, he
would certainly there and then, in going and coming, have walked in
front, bearing a spear or dah, a big curved knife like a sword. What
makes it needful to mention a thing so obvious to us who have lived
there is that Englishwomen sometimes resent, as degrading to their
sex,
49 the Oriental custom that makes the man stalk in front; whereas a
little reflection would show them, when familiar with plain facts of this
kind, that there are reasons for it honourable to human nature. It is
not as a master that a man, who is a man, precedes a woman, or
goes into war, or business, or politics; but as a pioneer, protector,
provider, and in short head servant. The old maid, at whom Dean
Ramsay made us laugh, because she “thought a man was perfect
salvation,” was moved by a wise inherited instinct, far different from
what simple sophisticated persons have hitherto supposed.
On this occasion there was no man at all, and in the absence of any
natural protector it was “go as you please.” A tigress in the bush saw
her chance. The lightest-limbed and lightest-laden of the trio was a
little girl, Mintha by name, who ran on in front. The tigress seized her
and carried her away.
There is a lot, at times, in etymology. An Englishman who knows
Burmese would tell you that Mintha means prince, or son of an official
(min); but, as written in Burmese, without a long accent on the tha,
and pronounced like an ordinary English word with the stress in front,
the name Mintha has another modest meaning which you may
discover from a dictionary, but can only with difficulty persuade a
Burman
50 to tell you. It means Better-than-an-Official, a name curiously
recalling the kind of names that were common in England in the great
days of Cromwell.
“We know what judges can be made to do,” said Selden, grimly.
“We know what officials are,” the Burmans have been saying for
centuries; and they class them with thieves and plagues, perhaps with
more emphasis to-day than ever before. So Mintha is an
unpretentious name, and so common that the little girl who bore it
had probably never thought of the meaning of it, and would certainly
have referred you to her mother if you had asked her about it.
She was perhaps eleven years old, but small for that age, this brown
little maiden whom they called “Better-than-an-Official,” and swift and
silent like a dream the tigress stepped out and picked her up and
carried her away between its teeth, as a cat does a little mouse.
Her older sister, Ngway Bwin, which means Silver-blossom, a girl on
the verge of womanhood, about fourteen years old, was next behind
her, and beheld her taken. She quickly turned to the third girl,
Shway U or Grain-of-Gold, who happened at that moment to have a
chopper in her hand; and, snatching the chopper, little Silver-blossom
ran
51 at the very top of her speed after the tigress. She overtook it, and

lifting the big knife high above her head with both hands, she brought
it down heavily on the animal’s head. It dropped little Mintha, “Better-
than-an-Official,” and stood as if it were stunned. It was easy to see
the need of keeping it stunned. Silver-blossom knew that that was her
only chance. So hammer, hammer, hammer, cut succeeding cut, the
little Burmese maiden killed the tigress.
Grain-of-Gold was the only other person near. She always said, and
says still (1909), that she did nothing but look on. The village
headman reported, and still reports, that the animal, which was
shown to everybody in 1894, was a full-grown tigress in the prime of
life, measuring “8 cubits and 2 meiks.” A cubit, in rough village
measures, is still the original cubit, from the elbow to the farthest
finger-tip, and a “meik” is the width of a clenched fist with the thumb
standing out. So 8 cubits and 2 meiks can hardly be less than 11 or
12 feet; but the villagers measure along the curved outline of the
body, so we may conclude the straight measurement was 8 or 9 feet.
The soft brown skin of Better-than-an-Official had been broken and
she was a little hurt on the back of the neck and on one arm; but
these
52 injuries were so slight that it is likely the tigress meant to give
its cubs the pleasure of playing with her, instead of which Better-than-
an-Official, saved by her sister and quickly cured of her scratches, is
now reported to be living at Kule village, Mingin township. The sister,
Silver-blossom herself, was quite unhurt. She became, deservedly, the
pride of the countryside, but “died of a decline” ten years afterwards.
If her adventure appeared in a romance one would smile at the
absurdity of the author who expected to be believed for a moment.
Yet, after carefully questioning everybody concerned, Mr Tilly, who is
a man of sense, believed it at the time and has never doubted it; and
Mr Grant Brown, after a new local inquiry, believes it; and so do I. Let
readers please themselves.
It may assist them to a right conclusion to remind them that Michelet
has shown that Joan of Arc seems stranger to us than she really was
because we are ignorant of history. Her performance was glorious for
herself and France, one of the most glorious episodes in the history of
the world; but all the same it was only the superlative of many similar
doings of brave French women. Precisely in the same way it has to be
remembered
53 that, like hens emboldened to fly in the faces of dogs or
boys in defence of chicks, many girls in charge of brothers or sisters
have been known to surpass belief in their feats of devotion. So
Silver-blossom was not odd in the sense of being peculiar. She was
like other brave girls, only more so.
At the same time it would be wrong to minimise what she did. It is
the exact truth to say she expanded the range of human possibilities.
Think of a Burmese child doing that!
Let them who know no better “explain” the miracle. The man who
ceases to wonder at it does not understand it. I frankly admire the
girl, and have no “explanation,” unless it be one to quote the hymn—
“God moves in a mysterious way,
His wonders to perform.”

A pious Quaker’s phrase would have been, “God moved her.” If there
is in English any better name for the Living Spirit of the Universe that
surged in her heart and nerved her arm, it is not known to me. But,
as a good Muslim Imam of my acquaintance once remarked to me,
“There are many names for God.”
54
vi

THE OLD MEN AND THE TIGER

T
HIS was told me in 1908 by Mr Thomson, who as District
Magistrate had held an inquest at the time upon the tragedy; and
his recollections have been verified and supplemented by
Mr Webb, the present District Magistrate. The depositions have, in
ordinary course, been destroyed; but the details that are still
recoverable seem to be sufficient.
The time was 1900, and the scene was Zwettaw village, Thongwa
township, not far from Rangoon. The old headman, U Myat Thin,
described in confidential official registers which he never saw as “an
easy-going old Talaing“ or native of Lower Burma, was sauntering
outside the village about midday, watching his grandchildren, who
were playing near him. Suddenly a tiger appeared and seized and
carried away his grand-daughter. That kind of thing is done with the
speed of thought; and Hercules himself, in the old man’s place, could
not
55
have prevented the tiger getting the child. Probably Hercules
himself, if unarmed, would have done no more than the old man did,
namely, run into the village and shout for help.
But who was to help? Every man and woman fit for work was away in
the fields. Only the old people and children were in the village. He
took a spear from his house, and three other old men like himself did
likewise. The four of them followed the tiger at once, and tracked and
ran with such goodwill that they overtook him, though they were too
late to save the child.
One of the finest traits of character which I have noticed in Burmese
villagers is their readiness to fight to recover from a wild beast the
body of any person it has killed. Let a European try to take a bone
from a bulldog and he may be able to guess, faintly and distantly, at
what these four old men were undertaking when they closed with a
famishing tiger, to fight him for his freshly-killed food. They had no
firearms, no missiles of any kind, not even bows and arrows. They
had nothing to rely on but each other, as, with one spirit, they
attacked him, thrusting at his vitals with their spears. The fight was
too unequal. He killed one of them, and with a stroke of his paw he
broke the shoulder of the grandfather, and so escaped away.
The
56 news was sent to the men in the fields, and as soon as possible a
new party took up the trail, including policemen with guns. They had
not far to go. In the next field they found the tiger—dead. He had
been gored to death by a herd of buffaloes that had been peacefully
grazing there when he came among them. If he had not been
wounded they would probably not have attacked him, or he would not
have lingered long enough to give them a chance. So the old men had
not fought in vain.
A herdsman of experience has said to me: “If the tiger was bleeding,
the sight of his blood would make the buffaloes charge him.” That
coincides with a red rag irritating a bull in England; but another
herdsman said it was the smell, and several thought the wound made
no difference. “A buffalo will not stand to be eaten by a tiger, but at
sight of one stampedes, either at him or away from him.” Very likely,
indeed.
“I think the grandfather recovered,” continued Mr Thomson. “I know I
recommended a good reward and that it was paid.” It appears from
the official registers that he was quite well before the end of the year.
On 12th December 1900 the Assistant Commissioner felt bound to
note, as a matter of business: “The daily pilgrimage to the local
Kyaung
57 (a Buddhist monastery) is the end of his existence now, I
think.” Why not? In the heroic days of Greece a time of prayer was
deemed the fittest ending to a well-spent life.
It was not till 29th June 1908 that the registers tell of him what has
some day to be told of us all—“Deceased. For successor see ...”
So far as can be discovered, the brave old man paid no heed
whatever to the rewards, or to what was thought about him. It was
right to honour such gallantry in every possible way; but the deed
was one no money could have purchased, and the story is one I like
to tell whenever I hear anybody who knows no better talking of the
“cowardice of the Burmans.”
58
vii

RECOVERING THE CORPSE

T
HE present Deputy Commissioner of Pyapon district, Burma (Major
Nethersole, 1909), is my authority for this incident, which is
selected as the most remarkable of several of its kind. He
investigated it on the spot, and told me of it at the time. He himself
gave as many days as he could spare to hunting the tiger concerned,
which killed eight men in Pyapon district before it met its fate.
One of them was old Po An, the headman of Eyya village. “Eyya” or
“Irra” is the first part of the name of our local Mississippi, the
Irrawaddy, and the village is, in fact, at the mouth of the great water-
way so called, though it is only one of many water-ways through
which the mighty river mingles with the sea. In other words, the
village is on the coast, and about the middle of the delta, between
Rangoon and Bassein.
In the last week of 1908 Po An and his son, and a friend of his own
age
59
(about sixty), left home together to get bamboos. They went in a
little boat, landed where they intended, entered the muddy woods
and cut what they wanted, and started to carry the bamboos to their
boat.
They had heard that there was a man-killing tiger “somewhere
thereabouts,” but the Burman with a knife in his hand is not easily
frightened in the forest. They made the mistake, which is the
besetting sin of brave men and used to be called English, of despising
the enemy, and did not even keep close together. In returning
bamboo-laden, Po An lagged behind “about forty yards,” but nobody
thought anything of that. His son and companion heard a noise in the
jungle too, but did not think of it till a minute or two later, when they
ceased to hear the sound of Po An behind, and shouted, “Are you all
right?” Receiving no reply they looked round. Not seeing him they laid
down their burdens and retraced their steps, but had not far to go. In
a glade through which they had come they saw the prostrate figure of
Po An and the tiger standing over him.
They were only two men, and one of them was old, and they had no
weapons but the big knives they had been using. But instantly they
flourished
60 their knives and moved forward, shouting and yelling as if
they were the advance guard of an army of men.
The tiger, a big animal in the prime of life, looked up at them in
deliberate surprise, and visibly hesitated. Then, as they approached,
he moved aside, slowly and reluctantly, into cover, as if to watch what
was going to happen and consider what to do.
The two men ran forward, snatched up the corpse and started for the
boat, looking round continually, brandishing their knives and shouting,
and seeing, or thinking they saw, those great eyes glaring at them
through the bushes. They said they even heard the tiger following.
Perhaps they did. Time after time they thought it was about to spring
upon them, and faced towards the sound, real or imaginary, with
knives uplifted and loud shouts of defiance. They reached the boat
and got on board, but did not take time to loose the rope. They cut it
and pushed off.
Next morning the elder of the two took Major Nethersole and another
officer to the place, and there they saw the severed rope and the
tracks of the tiger patrolling on the muddy banks. The tides had been
such that the tracks must have been made after the men departed,
and
61 left no room for doubt that the tiger had come after them to the
water’s edge, and there lingered long, going up and down as if in a
cage, and looking across the waters on which the men had
disappeared.
It was several days before the son of Po An and his old friend
discovered, as their excitement abated, how badly their nerves had
been shaken. Their sleep began to be broken by hideous dreams.
That was more than three months ago. The tiger is dead now (April
1909). His skull and hide can be seen at Pyapon. But still, I believe,
though now at greater and greater intervals, sometimes the one and
sometimes the other of the two brave men is wakened by the
nightmare of those awful eyes, and shrieks and shrieks to his
neighbours to come and stay beside him.
62
viii

THE INSPECTOR’S ESCAPE

I
T was about February 1891, and on the left or eastern bank of the
Sittang River in Toungoo district, Lower Burma, that an inspector of
police was riding northwards along a cart-road, through the woods,
as the daylight was quitting the sky, and “suddenly,” to use his own
words, “I seemed, at one and the same instant, to get a terrific blow
in the small of the back, and to feel the pony under me springing
upwards, as if it were jumping to the sky.” He completed his
description by gestures.
A listener suggested, “As if it were suddenly galloping up a wall?”
“Quite so,” said he. “The next I felt was that I seemed to fall back
upon something soft, and that’s all I know. The next I saw was the
people bending over me, and I could hear one say to another, ‘He’s
not dead yet,’ and others said, ‘He’s dead,’ but none of them touched
me,
63
and I tried to speak, but could not. Then after a long time
somebody saw I was breathing, and somebody put something under
my head, and ... I am not hurt, so far as I am aware,” concluded the
inspector, “but feel stunned and queer, and horribly helpless.”
The villagers said, “We saw the pony come galloping with an empty
saddle along the road which goes through the village, and in the
middle of the village it stopped short and made a noise. It was
quivering. Its hind-quarters were bleeding from great tiger’s claw-
marks as you see them yet.”
The poor beast was still sore from the scratches a month afterwards.
Whether it ever recovered I never heard.
With a celerity and courage characteristic of the unspoiled Burman,
every man in the village soon had a da (big knife) or home-made
spear in his hand, and many had torches or lamps as well. But while
they thus prepared for action promptly, it has to be noted that there
was a certain hesitation about starting. Some objected. Why? The
pony had been recognised as the inspector’s. He was rather popular
than otherwise, but he was a policeman. No Burman could say with
truth
64 that he thought it right to save the life of a policeman. Even the
older men, who were addicted to religion, could only say, “He’s a
man, after all.” Equally with the rest they believed that any policeman
in the pay of the English is irretrievably doomed to hell, and has
deserved to be. But, what made the pious elders on this occasion
more readily silent than they might otherwise have been, there were
several who delivered themselves of sentiments that might be
translated by a verse of an old English ballad:—
“Saddled and bridled
And booted rade he;
Toom hame (empty home) cam’ the saddle,
But never cam’ he!”

“It’s not a man that you’re going to save. You’re likely to be late for
that! It’s a corpse you’re going to take from a tiger.”
This was conclusive. The most scrupulous Burman can risk his life
with a clear conscience in fighting a tiger to recover a corpse. So the
crowd set out.
Great was their wonder to find the inspector prostrate upon the road,
unconscious, but unscratched. When they had heard his story they
said to me,—
“The
65 tiger cannot have seen him at all. Lying in wait here, it must
have seen only his piebald pony, and, leaping so as to land on its
shoulders, it must have knocked its nose severely against the man’s
back and slipped down. Then he fell upon it, and so perplexed it more
than ever, and it would step aside into cover to consider awhile.”
Perhaps the shrewdest remark made on the incident was this: “When
struck on the back, the man must have let out a howl. That would
frighten the tiger!” The inspector did not remember that, but could
not be expected to remember it. He would do it without thinking.
It was his own and the general opinion that if help had not come, as
it did, the tiger would have come back; and, humanity mastering
prejudice, the people said, “We are glad we came.”
The fright made him talk of leaving the police and leading a new life.
But his salary was good. He was like the rich man in Scripture, who
had great possessions. The villagers did not blame him for changing
his mind and not resigning. It was as much in earnest as in jest that
they said, “He may become religious, when he takes his pension.”
About the same time as this wonderful escape, a lonely leper who
lived
66 in a hut, like a hermit, on the opposite side of the river,
disappeared for ever, and the few bloody rags that were left and the
tell-tale footprints showed that the tiger had come upon him, like a
thief in the night, and carried him bodily away.
“We are very sorry for the leper,” said the villagers to the inspector,
when he next rode by, and the fate of the leper was discussed. “We
are very sorry for the leper, and for the tiger too. Either your pony or
yourself would have been more wholesome eating.”
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookmasss.com

You might also like