Computer Programming 1st Edition E. Balagurusamy download
Computer Programming 1st Edition E. Balagurusamy download
Balagurusamy
download
https://ebookgate.com/product/computer-programming-1st-edition-e-
balagurusamy/
https://ebookgate.com/product/programming-in-ansi-c-6th-edition-
e-balagurusamy/
https://ebookgate.com/product/c-programming-data-structures-4th-
edition-e-balagurusamy/
https://ebookgate.com/product/computer-programming-for-teens-1st-
edition-mary-e-farrell/
https://ebookgate.com/product/advanced-computer-programming-in-
python-1st-edition-karim-pichara/
Computer Arithmetic Volume I Earl E Swartzlander
https://ebookgate.com/product/computer-arithmetic-volume-i-earl-
e-swartzlander/
https://ebookgate.com/product/practical-programming-an-
introduction-to-computer-science-using-python-jennifer-campbell/
https://ebookgate.com/product/programming-with-java-a-
primer-3-e-3rd-edition-e-balaguruswamy/
https://ebookgate.com/product/mathematics-for-3d-game-
programming-and-computer-graphics-second-edition-eric-lengyel/
https://ebookgate.com/product/numerical-computer-methods-
part-e-1st-edition-michael-l-johnson/
As per
JNTU-Hyderabad
Syllabus regulation
2013
Computer Programming
First Edition
About the Author
E Balagurusamy, former Vice Chancellor, Anna University, Chennai, is currently Member, Union Public
Service Commission, New Delhi. 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, Roorkee. His areas of interest include Object-Oriented
Software Engineering, Electronic Business, 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:
• Computing Fundamentals and C Programming
• Fundamentals of Computers
• Programming in C#, 3/e
• Programming in Java, 4/e
• Object-Oriented Programming with C++, 5/e
• Programming in BASIC, 3/e
• Programming in ANSI C, 5/e
• Numerical Methods
• Reliability Engineering
A recipient of numerous honours and awards, he has been listed in the Directory of Who’s Who of
Intellectuals and in the Directory of Distinguished Leaders in Education.
As per
JNTU-Hyderabad
Syllabus regulation
2013
Computer Programming
First Edition
E Balagurusamy
Chairman
EBG Foundation
Coimbatore
Computer Programming, 1e
Copyright © 2014, 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 listing (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.
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 Text-o-Graphics, B-1/56, Aravali Apartment, Sector-34, Noida 201 301, and printed at
Cover Printer:
Content
Preface xv
Roadmap to the Syllabus xix
2 Introduction to C 2.1-2.147
2.1 Introduction 2.1
2.2 Overview of C 2.2
2.2.1 History of C 2.2
2.2.2 Characteristics of C 2.4
2.2.3 Sample Program 1: Printing a Message 2.4
2.2.4 Sample Program 2: Adding Two Numbers 2.7
2.2.5 Sample Program 3: Interest Calculation 2.8
2.2.6 Sample Program 4: Use of Subroutines 2.10
2.2.7 Sample Program 5: Use of Math functions 2.11
2.3 Basic Structure of C Programs 2.13
2.4 Programming Style 2.13
2.5 Executing A ‘C’ Program 2.14
2.6 UNIX System 2.15
2.7 C Character Set 2.17
2.7.1 Trigraph Characters 2.19
2.8 C Tokens 2.19
2.9 Keywords and Identifiers 2.20
2.10 Constants 2.21
2.10.1 Integer Constants 2.21
2.10.2 Real Constants 2.22
2.10.3 Single Character Constants 2.23
2.10.4 String Constants 2.24
2.11 Variables 2.24
2.12 Data Types 2.25
Contents vii
Appendix A A.1-A.12
The developments in digital electronics and related technologies during the last few decades have ushered
in the second Industrial Revolution that is popularly referred to as the Information Revolution. Computer
technology plays an ever-increasing role in this new revolution. Today, the application of computers is all
pervasive in everybody’s life. A sound knowledge of how computers process data and information has,
therefore, become indispensable for anyone who seeks employment not only in the area of IT but also in any
other field.
COMPUTER PROGRAMMING
Computer programming is dedicated to writing, testing and maintaining programs that computers follow to
perform their functions. To create programs that control the behaviour of a machine, we need programming
languages. This book enables students to master the necessary skills for computer programming with C
language and shows them how to use these skills wisely with data structures and algorithms.
DATA STRUCTURES
Data structures are prevalent in almost every program, since they provide specialised formats of storing and
organising data in a computer. This book presents the design and implementation of data structures using
standard ANSI C programming language.
xvi Preface
PEDAGOGICAL FEATURES
• Bottom-up approach of explaining concepts.
• Algorithms and flowcharts are covered extensively.
• Codes and comments illustrate the use of various features of the language.
• Special boxes feature supplementary information and notes that complement the text.
• Case studies in relevant chapters demonstrate real-life applications.
• Just remember section lists out helpful hints and possible problem areas.
• Review questions (132) provide ample opportunities to test the conceptual understanding.
• Programming exercises (135) simulate interest to practice programming applications.
• Solved examples and programs (200) have been tested using compilers compatible to both UNIX
and MS-DOS operating systems and, wherever appropriate, the nature of output has been discussed.
These programs also demonstrate the general principles of a good programming style.
• Multiple choice questions (179) help students test their conceptual understanding of the subject.
• Lab assignments are given as per the new syllabus.
• Updated with information on compiler C-99 supported by numerous programs (12) using C-99.
• Solutions to 2011 exam question papers (4 sets) and 2012 exam question paper.
Preface xvii
CD RESOURCES
The book is accompanied with a CD which provides the following resources:
• All lab assignments
• Previous years’ solved university question papers
• 208 additional objective/ review/ debugging type questions pertaining to each unit
• 5 Model Question Papers
The supplementary CD helps students master the programming language and write their own programs
using Computer programming concepts and data structures.
ACKNOWLEDGEMENTS
The author is grateful to Mrs Nagaratna Parameshwar Hegde of Vasavi College of Engineering, Hyderabad
for her useful comments and suggestions.
E Balagurusamy
PUBLISHER’S NOTE
McGraw Hill Education (India) looks forward to receiving from teachers and students their valuable views,
comments and suggestions for improvements, all of which may be sent to tmh.corefeedback@gmail.com
(mentioning the title and author’s name). Also, please inform any observations on piracy related issues.
Roadmap to the Syllabus
COMPUTER PROGRAMMING
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
GO TO:
CHAPTER 1. Introduction to Computers
CHAPTER 2. Introduction to C
Module 2: Functions-Designing Structured Programs, Functions, user defined functions, inter function
communication, Standard functions, Scope, Storage classes-auto, register, static, extern, scope rules, type
qualifiers, recursion–recursive functions, Limitations of recursion, example C programs, Preprocessor
commands.
Arrays—Concepts, using arrays in C, inter function communication, array applications, two-dimensional
arrays, multidimensional arrays, C program examples.
GO TO:
CHAPTER 3A. Functions
CHAPTER 3B. Arrays
Module 3: Pointers—Introduction (Basic Concepts), Pointers for inter function communication, pointers
to pointers, compatibility, Pointer Applications-Arrays and Pointers, Pointer Arithmetic and arrays,
Passing an array to a function, memory allocation functions, array of pointers, programming applications,
pointers to void, pointers to functions.
Strings—Concepts, C Strings, String Input I Output functions, arrays of strings, string manipulation
functions, string I data conversion, C program examples.
GO TO:
CHAPTER 4A. Pointers
CHAPTER 4B. Strings
xx Roadmap to the Syllabus
Module 4: Enumerated, Structure, and Union Types—The Type Definition (typedef), Enumerated types,
Structures—Declaration, initialization, accessing structures, operations on structures, Complex structures,
structures and functions, Passing structures through pointers, self referential structures, unions, bit fields,
C programming examples, command-line arguments,
Input and Output—Concept of a file, streams, text files and binary files, Differences between text and
binary files, State of a file, Opening and Closing files, file input 1 output functions (standard library
input 1 output functions for files), file status functions (error handling), Positioning functions, C program
examples.
GO TO:
CHAPTER 5. Structures and Unions
CHAPTER 6. File Management in C
Module 5: Searching and Sorting—Sorting-selection sort, bubble sort, Searching-linear and binary
search methods.
Lists- Linear list—singly linked list implementation, insertion, deletion and searching operations on
linear list, StacksPush and Pop Operations, Queues—Enqueue and Dequeue operations.
GO TO:
CHAPTER 7. Sorting and Searching Techniques
CHAPTER 8. Data Structures
UNIT
1 Introduction to
Computers
1.1 INTRODUCTION
The term computer is derived from the word INPUT OUTPUT
compute. A computer is an electronic device Data PROCESS Information
that takes data and instructions as an input from
the user, processes data, and provides useful
information known as output. This cycle of Instructions
operation of a computer is known as the input–
Fig. 1.1 Input–process–output concept
process–output cycle and is shown 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
as secondary memory. Primary memory includes Random Access Memory (RAM) and secondary
memory includes hard disks and floppy disks.
Software supports the functioning of a computer system internally and cannot be seen. It is stored on
secondary memory and can be an application software as well as system software. The application software
is used to perform a specific task according to requirements and the system software is mandatory for running
application software. The examples of application software include Excel and MS Word and the examples of
system software include operating system and networking system.
All the hardware components interact with each other as well as with the software. Similarly, the different
types of software interact with each other and with the hardware components. The interaction between various
hardware components is illustrated in Fig. 1.3.
1.2.1 Input Devices
Input devices can be connected to the computer system using cables. The most commonly used input devices
among others are:
• Keyboard
• Mouse
• Scanner
Magnetic Magnetic
Tape Disk
Arithmetic
Unit
Control
Unit
CPU
Data and results flow
Control Instructions to units
Instructions to control unit
Keyboard
A standard keyboard includes alphanumeric keys, function keys, modifier keys, cursor movement keys,
spacebar, escape key, numeric keypad, and some special keys, such as Page Up, Page Down, Home, Insert,
Delete and End. The alphanumeric keys include the number keys and the alphabet keys. The function keys
are the keys that help perform a specific task such as searching a file or refreshing a Web page. The modifier
1.4 Computer Programming
keys such as Shift and Control keys modify the casing style of a character or symbol. The cursor movement
keys include up, down, left and right keys and are used to modify the direction of the cursor on the screen.
The spacebar key shifts the cursor to the right by one position. The numeric keypad uses separate keypads for
numbers and mathematical operators. A keyboard is show in Fig. 1.4.
Function Keys
(F1 to F12)
Escape Key
Special Keys
Numeric Keypad
Modifier Keys
Mouse
The mouse allows the user to select elements on the screen, such Wheel
as tools, icons, and buttons, by pointing and clicking them. We can Right Button
also use a mouse to draw and paint on the screen of the computer Left Button
system. The mouse is also known as a pointing device because it
helps change the position of the pointer or cursor on the screen.
The mouse consists of two buttons, a wheel at the top and a
ball at the bottom of the mouse. When the ball moves, the cursor
on the screen moves in the direction in which the ball rotates. The Fig. 1.5 Mouse
left button of the mouse is used to select an element and the right
button, when clicked, displays the special options such as open and explore and shortcut menus. The wheel
is used to scroll down in a document or a Web page. A mouse is shown in Fig. 1.5.
Scanner
A scanner is an input device that converts documents and images as the
digitized images understandable by the computer system. The digitized
images can be produced as black and white images, gray images, or
colored images. In case of colored images, an image is considered as a
collection of dots with each dot representing a combination of red, green,
and blue colors, varying in proportions. The proportions of red, green, and
blue colors assigned to a dot are together called as color description. The
scanner uses the color description of the dots to produce a digitized image.
Fig. 1.6 shows a scanner.
There are the following types of scanners that can be used to produce Fig. 1.6 Scanner
digitized images:
• Flatbed scanner It contains a scanner head that moves across a page from top to bottom to read the
page and converts the image or text available on the page in digital form. The flatbed scanner is used
to scan graphics, oversized documents, and pages from books.
Introduction to Computers 1.5
• Drum scanner In this type of scanner, a fixed scanner head is used and the image to be scanned is
moved across the head. The drum scanners are used for scanning prepress materials.
• Slide scanner It is a scanner that can scan photographic slides directly to produce files understandable
by the computer.
• Handheld scanner It is a scanner that is moved by the end user across the page to be scanned. This
type of scanner is inexpensive and small in size.
1.2.2 CPU
The CPU consists of Control Unit (CU) and ALU. CU stores the instruction set, which specifies the operations
to be performed by the computer. CU transfers the data and the instructions to the ALU for an arithmetic
operation. ALU performs arithmetical or logical operations on the data received. The CPU registers store the
data to be processed by the CPU and the processed data also. Apart from CU and ALU, CPU seeks help from
the following hardware devices to process the data:
Motherboard
It refers to a device used for connecting the CPU with the input and output devices. The components on the
motherboard are connected to all parts of a computer and are kept insulated from each other. Some of the
components of a motherboard are:
• Buses Electrical pathways that transfer data and instructions among different parts of the computer.
For example, the data bus is an electrical pathway that transfers data among the microprocessor,
memory and input/output devices connected to the computer. The address bus is connected among
the microprocessor, RAM and Read Only Memory (ROM), to transfer addresses of RAM and ROM
locations that is to be accessed by the microprocessor.
• System clock It is a clock used for synchronizing the activities performed by the computer. The
electrical signals that are passed inside a computer are timed, based on the tick of the clock. As a
result, the faster the system clock, the faster is the processing speed of the computer.
• Microprocessor CPU component that performs the processing and controls the activities performed
by the different parts of the computer. The microprocessor is plugged to the CPU socket placed on the
motherboard.
• ROM Chip that contains the permanent memory of the computer that stores information, which
cannot be modified by the end user.
Monitor
A monitor is the most commonly used output device that produces visual
displays generated by the computer. The monitor, also known as a screen, is
connected as an external device using cables or connected either as a part of the
CPU case. The monitor connected using cables, is connected to the video card
placed on the expansion slot of the motherboard. The display device is used for
visual presentation of textual and graphical information.
The monitors can be classified as cathode ray tube (CRT) monitors or liquid
crystal display (LCD) monitors. The CRT monitors are large, occupy more space
in the computer, whereas LCD monitors are thin, light weighted, and occupy Fig. 1.8 Monitor
lesser space. Both the monitors are available as monochrome, gray scale and
color models. However, the quality of the visual display produced by the CRT is
better than that produced by the LCD.
A monitor can be characterized by its monitor size and resolution. The monitor size is the length of
the screen that is measured diagonally. The resolution of the screen is expressed as the number of picture
Introduction to Computers 1.7
elements or pixels of the screen. The resolution of the monitor is also called the dot pitch. The monitor with
a higher resolution produces a clearer image.
Printer
The printer is an output device that is used to produce a hard copy of the
electronic text displayed on the screen, in the form of paper sheets that can be
used by the end user. The printer is an external device that is connected to the
computer system using cables. The computer needs to convert the document
that is to be printed to data that is understandable by the printer. The printer
driver software or the print driver software is used to convert a document to
a form understandable by the computer. When the computer components are
upgraded, the upgraded printer driver software needs to be installed on the
computer.
Fig. 1.9 Printer
The performance of a printer is measured in terms of dots per inch (DPI)
and pages per minute (PPM) produced by the printer. The greater the DPI
parameter of a printer, the better is the quality of the output generated by it. The higher PPM represents
higher efficiency of the printer. Printers can be classified based on the technology they use to print the text
and images:
• Dot matrix printers Dot matrix printers are impact printers that use perforated sheet to print the
text. The process to print a text involves striking a pin against a ribbon to produce its impression on
the paper.
• Inkjet printers Inkjet printers are slower than dot matrix printers and are used to generate high
quality photographic prints. Inkjet printers are not impact printers. The ink cartridges are attached to
the printer head that moves horizontally, from left to right.
• Laser printers The laser printer may or may not be connected to a computer, to generate an output.
These printers consist of a microprocessor, ROM and RAM, which can be used to store the textual
information. The printer uses a cylindrical drum, a toner and the laser beam.
Speaker
The speaker is an electromechanical transducer that converts an electrical
signal into sound. They are attached to a computer as output devices, to
provide audio output, such as warning sounds and Internet audios. We can
have built-in speakers or attached speakers in a computer to warn end users
with error audio messages and alerts. The audio drivers need to be installed in
the computer to produce the audio output. The sound card being used in the
computer system decides the quality of audio that we listen using music CDs
or over the Internet. The computer speakers vary widely in terms of quality
and price. The sophisticated computer speakers may have a subwoofer unit, to
enhance bass output. Fig. 1.10 Speakers
Plotter
The plotter is another commonly used output device that is connected to a computer to print large documents,
such as engineering or constructional drawings. Plotters use multiple ink pens or inkjets with color cartridges
1.8 Computer Programming
for printing. A computer transmits binary signals to all the print heads of the plotter. Each binary signal
contains the coordinates of where a print head needs to be positioned for printing. Plotters are classified on
the basis of their performance, as follows:
• Drum plotter They are used to draw perfect circles and other graphic images. They use a drawing
arm to draw the image. The drum plotter moves the paper back and forth through a roller and the
drawing arm moves across the paper.
• Flat-bed plotter A flat bed plotter has a flat drawing surface and the two drawing arms that move
across the paper sheet, drawing an image. The plotter has a low speed of printing and is large in
size.
• Inkjet plotter Spray nozzles are used to generate images by spraying droplets of ink onto the paper.
However, the spray nozzles can get clogged and require regular cleaning, thus resulting in a high
maintenance cost.
• Electrostatic plotter As compared to other plotters, an electrostatic plotter produces quality print
with highest speed. It uses charged electric wires and special dielectric paper for drawing.
Control
Buttons
Plotted
Paper
1.2.4 Memory
The memory unit of a computer is used to store data, instructions for processing data, intermediate results
of processing and the final processed information. The memory units of a computer are classified as primary
memory and secondary memory. Figure 1.12 shows the memory categorization in a computer system.
Introduction to Computers 1.9
Primary Memory
The primary memory is available in the computer as a built-in unit of the computer. The primary memory is
represented as a set of locations with each location occupying 8 bits. Each bit in the memory is identified by
a unique address. The data is stored in the machine-understandable binary form in these memory locations.
The commonly used primary memories are:
• ROM ROM represents Read Only Memory that stores data and instructions, even when the
computer is turned off. It is the permanent memory of the computer where the contents cannot be
modified by an end user. ROM is a chip that is inserted into the motherboard. It is generally used to
store the Basic Input/Output system (BIOS), which performs the Power On Self Test (POST).
• RAM RAM is the read/write memory unit in
which the information is retained only as long
as there is a regular power supply. When the
power supply is interrupted or switched off, the
information stored in the RAM is lost. RAM is a
volatile memory that temporarily stores data and
applications as long as they are in use. When the
Integrated
use of data or the application is over, the content in chips
RAM is erased.
Fig. 1.13 RAM
• Cache memory Cache memory is used to store
the data and the related application that was last processed by the CPU. When the processor performs
processing, it first searches the cache memory and then the RAM, for an instruction. The cache
memory is always placed between CPU and the main memory of the computer system.
1.10 Computer Programming
Table 1.1 depicts some of the key differences between RAM and ROM:
TABLE 1.1
RAM ROM
It is a read/write memory It is a read only memory
It is volatile storage device It is a permanent storage device
Data is erased as soon as power supply is Data remains stored even after power supply
turned off has been turned off
It is used as the main memory of a computer It is used to store Basic input output system
system (BIOS).
Secondary Memory
Secondary memory represents the external storage devices that are connected to the computer. They provide
a non-volatile memory source used to store information that is not in use currently. A storage device is either
located in the CPU casing of the computer or is connected externally to the computer. The secondary storage
devices can be classified as:
• Magnetic storage device The magnetic storage
devices store information that can be read, erased
and rewritten a number of times. These include
floppy disk, hard disk and magnetic tapes.
• Optical storage device The optical storage devices
are secondary storage devices that use laser beams
to read the stored data. These include CD-ROM,
rewritable compact disk (CD-RW), and digital video
disks with read only memory (DVD-ROM). Fig. 1.14 Magnetic tape
Tracks
Sectors
Protective coating
Dielectric
layers
Laser beams
Lens
Substrate layer
in comparison to other storage devices like CD and floppy disk. One of the most important advantages
of a USB drive is that it is larger in capacity as compared to other removable storage devices. Off late,
it has become very popular amongst computer users.
An assembly language program consists of a series of instructions and mnemonics that correspond to a
stream of executable instructions. An assembly language instruction consists of a mnemonic code followed
by zero or more operands. The mnemonic code is called the operation code or opcode, which specifies the
operation to be performed on the given arguments. Consider the following machine code:
10110000 01100001
Its equivalent assembly language representation is:
mov al, 061h
In the above instruction, the opcode “move” is used to move the hexadecimal value 61 into the processor
register named ‘al’. The following program shows the assembly language instructions to subtract two
numbers:
ORG 500 /Origin of program is location 500
LDA SUB /Load subtrahend to AC
CMA /Complement AC
INC /Increment AC
ADD MIN /Add minuend to AC
STA DIF /Store difference
HLT /Halt computer
MIN, DEC 56 /Minuend
SUB, DEC -2 /Subtrahend
DIF, HEX 0 /Difference stored here
END /End of symbolic program
It should be noted that during execution, the assembly language program is converted into the machine
code with the help of an assembler. The simple assembly language statements had one-to-one correspondence
with the machine language statements. This one-to-one correspondence still generated complex programs.
Then, macroinstructions were devised so that multiple machine language statements could be represented
using a single assembly language instruction. Even today programmers prefer to use an assembly language
for performing certain tasks such as:
• To initialize and test the system hardware prior to booting the operating system. This assembly
language code is stored in ROM
• To write patches for disassembling viruses, in anti-virus product development companies
• To attain extreme optimization, for example, in an inner loop in a processor-intensive algorithm
• For direct interaction with the hardware
• In extremely high-security situations where complete control over the environment is required
• To maximize the use of limited resources, in a system with severe resource constraints
STORE C
Using FORTRAN, the above code can be represented as:
C=A+B
The above high-level language code is executed by translating it into the corresponding machine language
code with the help of a compiler or interpreter.
High-level languages can be classified into the following three categories:
• Procedure-oriented languages (third generation)
• Problem-oriented languages (fourth generation)
• Natural languages (fifth generation)
such as LISP and PROLOG are mainly used to develop artificial intelligence and expert systems. These
languages are widely known as fifth generation languages.
The programming languages of this generation mainly focus on constraint programming, which is
somewhat similar to declarative programming. It is a programming paradigm in which the programmer only
needs to specify the solution to be found within the constraints rather than specifying the method of finding
the desired solution
The programming languages of this generation allow the users to communicate with the computer system
in a simple and an easy manner. Programmers can use normal English words while interacting with the
computer system.
Further, it suggests avoiding the use of goto, break and continue statements in a program as all these are
unconditional branch statements.
Language Translators
• Assembler An assembler is a computer program that translates assembly language statements into
machine language codes. The assembler takes each of the assembly language statements from the source
code and generates a corresponding bit stream using 0’s and 1’s. The output of the assembler in the form of
sequence of 0’s and 1’s is called object code or machine code. This machine code is finally executed to obtain
the results.
A modern assembler translates the assembly instruction mnemonics into opcodes and resolves symbolic
names for memory locations and other entities to create the object code. Several sophisticated assemblers
provide additional facilities that control the assembly process, facilitate program development, and aid
debugging. The modern assemblers like Sun SPARC and MIPS based on RISC architectures, optimize
instruction scheduling to attain efficient utilization of CPU. The modern assemblers generally include a
macro facility and are called macro assemblers.
Assemblers can be classified as single-pass assemblers and two-pass assemblers. The single-pass
assembler was the first assembler that processed the source code once to replace the mnemonics with the
binary code. The single-pass assembler was unable to support advanced source-code optimization. As a
result, the two-pass assembler was developed that read the program twice. During the first pass, all the
variables and labels are read and placed into the symbol table. On the second pass, the label gaps are filled from
the table by replacing the label name with the address. This helps to attain higher optimization of the source
code. The translation process of an assembler consists of the following tasks:
• Replacing symbolic addresses like LOOP, by numeric addresses
• Replacing symbolic operation code by machine operation codes
• Reserving storage for the instructions and data
• Translating constants into their machine representation
• Compiler The compiler is a computer program that translates the source code written in a high-level
language into the corresponding object code of the low-level language. This translation process is called
compilation. The entire high-level program is converted into the executable machine code file. A program
that translates from a low-level language to a high-level one is a decompiler. Compiled languages include
COBOL, FORTRAN, C, C++, etc.
In 1952, Grace Hopper wrote the first compiler for the A-0 programming language. In 1957, John Backus
at IBM introduced the first complete compiler. With the increasing complexity of computer architectures
and expanding functionality supported by newer programming languages, compilers have become more
Introduction to Computers 1.17
and more complex. Though early compilers were written in assembly languages, nowadays it has become
common practice to implement a compiler in the language it compiles. Compilers are also classified as single-
pass compilers and multi-pass compilers. Though single-pass compilers are generally faster than multi-pass
compilers, for sophisticated optimization, multi-pass assemblers are required to generate high-quality code.
• Interpreter The interpreter is a translation program that converts each high-level program statement
into the corresponding machine code. This translation process is carried out just before the program statement
is executed. Instead of the entire program, one statement at a time is translated and executed immediately.
The commonly used interpreted language are BASIC and PERL. Although, interpreters are easier to create as
compared to compilers, the compiled languages can be executed more efficiently and are faster.
Linkers
Most of the high-level languages allow the developer to develop a large program containing multiple modules.
Linker arranges the object code of all the modules that have been generated by the language translator into
a single program. The execution unit of the computer system is incapable of linking all the modules at
the execution time and therefore, linker is regarded as one of the important software because of its ability
to combine all the modules into a single program. Linker assembles the various objects generated by the
compiler in such a manner that all the objects are accepted as a single program during execution. Linker
also includes the links of various objects, which are defined in the runtime libraries. In many cases, linker
inserts the symbolic address of the objects in place of their real address. Figure 1.19 illustrates the working
of a linker.
Debuggers
Debugger is the software that is used to detect the errors and bugs present in the programs. The debugger
locates the position of the errors in the program code with the help of what is known as the Instruction Set
. Executable
. Linker Program
.
Language Object Code
Module n
Translator
Source Code
Routine
Libraries
Simulator (ISS) technique. ISS is capable of stopping the execution of a program at the point where an
erroneous statement is encountered.
Debugger is divided into two types, namely machine-level debugger and symbolic debugger. The machine-
level debugger debugs the object code of the program and shows all the lines where bugs are detected. On
the other hand, the symbolic debugger debugs the original code, i.e., the high-level language code of the
program. It shows the position of the bug in the original code of the program developed by the programmer.
While debugging a program, the debugger performs a number of functions other than debugging, such as
inserting breakpoints in the original code, tracking the value of specific variables, etc. In order to debug the
program, a debugger helps perform the following tasks:
• Step-by-step execution of a program
• Back tracking for checking the previous steps
• Stopping the execution of the program until the errors are corrected
Editors
Editor is a special program that allows the user to work with text in a computer system. It is used for the
documentation purposes and enables us to edit the information present in an existing document or a file. The
editor enables us to perform various editing operations such as copy, cut and paste while editing the text. On
the basis of the content edited by the editors, they are divided into the following categories:
• Text editor It is used to edit plain text. An operating system always includes a text editor for
updating the configuration files.
• Digital audio editor It is used to edit the information related to the audio components of a
multimedia application. These editors are used in audio applications where editing the music and the
sound signals is necessary.
• Graphics editor It is used to edit the information related to the graphical objects. These editors
are generally used in the multimedia applications where the user is working with multiple animation
objects.
• Binary file editor It is used to edit the digital data or the binary data, i.e., data having strings of 0s
and 1s.
• HTML editor It is used to edit the information included in the Web pages.
• Source code editor It is used to edit the source code of a program written in a programming
language such as C, C++ and Java.
factors that should be taken into consideration while selecting the target programming language, such as
performance and efficiency of the programming language, programmer’s prior experience with the language,
etc.
A programming language is typically bundled together with an IDE containing the necessary tools for
developing, editing, running and debugging a computer program. For instance, Turbo C is provided with a
strong and powerful IDE to develop, compile, debug and execute the programs.
Figure 1.20 shows the IDE of C language.
Start
False
Display ‘‘Fail’’
End
Fig. 1.21 Flowchart for calculating the percentage of marks and displaying the result.
After developing the algorithm and flowchart, the actual development of the program can be started in the
source code editor of C language. The following code shows the C language program for calculating the
percentage of marks in two different subjects for a student.
#include<stdio.h>
#include<conio.h>
void main()
{
float mark1,mark2;
float percentage;
clrscr();
printf("\n Enter marks of first subject:");
scanf("\n %f", &mark1);
printf("\n Enter marks of second subject:");
scanf("\n %f", &mark2);
percentage =((mark1+mark2)/200)*100;
if(percentage>40)
Introduction to Computers 1.21
Figure 1.22 shows the program code in the source code editor of C language.
Analysing the
requirements
Feasibility
Analysis
Creating
the Design
Developing
code
Testing the
software
Deploying
the software
Maintaining
the software
• Analysing operational feasibility Operational feasibility assessment involves studying the software
on operational and maintenance fronts. The operational feasibility of any software is done on the basis
of several factors, such as:
– Type of tools needed for operating the software
– Skill set required for operating the software
– Documentation and other support required for operating the software
• The code for different modules of the new software must be simple so that it can be easily
understood.
• The code must be logically correct so as to minimise logical errors in the program.
LAW, The. The words used by Muslims to express “the law,” are ash-
(2) Ādāb embraces the consideration of all those moral excellences which
are enjoined in the Qurʾān and Traditions, as Ik͟ hlāṣ, “sincerity”;
Tawwakkul, “confidence in God”; Tawāz̤ uʿ, “humility”; Tafwīẓ,
“resignation”; Qaṣru ʾl-ʿAmal, “keeping down one’s expectation”; Zuhd fī
ʾd-dunyā, “renunciation of the world”; Naṣīḥah, “giving good counsel and
advice”; Qanāʿah, “contentment”; Sak͟ hāwah, “liberality”; Ḥubb, “love to
God and man”; Ṣabr, “patience”; &c. (See Majmaʿu ʾl-Biḥār, vol. ii. p.
422.)
(3) ʿIbādāt, includes all acts of devotion to God, such as are included in the
five pillars of practice: (a) Recital of the Creed; (b) Prayer; (c) Zakāt, or
“legal alms”; (d) Ṣaum, or “fasting”; (e) The pilgrimage to Makkah. It will
also embrace such religious acts as Jihād, or warfare for the propagation of
the religion of Islām.
(4) Muʿāmalāt, includes such duties as are required between man and man,
and is divided into Muk͟ hāṣamāt, “altercations”; Munākaḥāt, “nuptials”;
Amānāt, “securities.” Under these three heads are embraced all the various
sections of civil jurisprudence such as barter, sale, agency, larceny,
marriage, divorce, dower, partnership, claims, &c.
Muslim law is also divided into two great distinctions of Mashrūʿ, “lawful,”
and G͟ hairu ʾl-mashrūʿ, “unlawful,” or, as it is expressed in Persian, Rawā
and Nārawā.
That which is lawful is graded into five classes. (1) Farẓ, that which is
proved beyond all doubt to have been enjoined either in the Qurʾān or in a
tradition of undoubted authority, and the denial or disobedience of which is
positive infidelity. (2) Wājib, that which is obligatory, but of which there is
some doubt whether or not it was enjoined in the Qurʾān or in a tradition of
undoubted authority. (3) Sunnah, that which was practised by Muḥammad;
(4) Mustāḥabb, that which Muḥammad and his Companions sometimes did
and sometimes omitted; (5) Mubāḥ, that which is desirable, but which may
be omitted without fear of sin.
Things which are unlawful are graded into three classes: (1) Mufsid, that
which is most vicious and corrupting, a mortal sin; (2) Ḥarām, that which is
distinctly forbidden; (3) Makrūh, that which is generally held to be unclean.
It will be seen how important a place the example, practices, and sayings of
Muḥammad occupy in the moral law of Islām. This branch of Muslim law
is called as-Sunnah, or the custom of Muḥammad, and is distinguished as—
It is therefore a serious mistake to suppose that the Qurʾān contains all that
is esteemed necessary for faith and practice in Islām; the example of
Muḥammad is as binding upon the Muslim as any injunction contained in
the Qurʾān itself, for neither that which is Farẓ nor that which is Sunnah
can be omitted without sin.
The true origin and fountain of all law is the Qurʾān and the Traditions, and
no Muslim school of theology has ever rejected the Traditions. They are
binding upon Sunnī, and Shīʿah, and Wahhābī; the only difference between
the Sunnī and Shīʿah being that they receive different collections of
Traditions. The Wahhābīs receive those of the Sunnīs, and call themselves
Muḥaddis̤ in, or traditionists.
In addition to the Qurʾān and Ḥadīs̤ (or Traditions), both Sunnī and Shīʿah
Muslims acknowledge the concurrence of the learned, called Ijmāʿ, the
Shīʿahs believing that they still possess Mujtahids capable of giving an
infallible interpretation of the law; the Sunnīs, on the other hand, confessing
that, since the days of the four great doctors (Abū Ḥanīfah, Mālik, ash-
Shāfiʿī, and Ibn Ḥanbal), Ijmāʿ has not been possible; whilst the Wahhābīs
accept only the Ijmāʿ of those who conversed with the Prophet himself. The
fourth foundation of orthodoxy in both Sunnī and Shīʿah schools is the
system of interpretation called Qiyās, or ratiocination.
I. The Sunnīs all receive the same collections of traditions, especially those
which are known as the “six correct books,” the Ṣaḥīḥu ʾl-Buk͟ hārī, the
Ṣaḥīḥu Muslim, the Sunanu ʾt-Tirmiẓī, Sunanu Abī Dāʾūd, Sunanu an-
Nasafī, and Sunanu Ibn Mājah. The compilation by the Imām Mālik, which
is first in order of date, is also a collection of traditions of very great
authority. [traditions.]
These different sects of Sunnīs do not differ in uṣūl, or fundamentals of
religious belief, but in minor rules of practice, and in certain legal
interpretations; but being of different opinions and broaching in some
respects separate doctrines, four schools of jurisprudence have been
established, known as Ḥanafī, Shāfiʿī, Ḥanbalī, and Mālikī.
The differences amongst these four Sunnī schools are based either upon
different traditions or upon different interpretations of the same traditions,
also upon the various ways in which the liberty of qiyās, or ratiocination,
has been exercised. Consequently the number of works which have
appeared on the subjects of scholastic science and jurisprudence, has been
very great indeed.
We are indebted to Mr. Shama Churun Sircar, the learned and able Tagore
Professor of Law in Calcutta, for the following résumé of the principal
Sunnī writings on ash-Sharʿ.
“The chief works that treat generally of the doctrines of the four principal
sects of the Sunnís, are mentioned by Hájí Khalífah to be the Jámi-ul-
Mazáhib (Jāmiʿu ʾl-Maẕāhib), the Majmaa-ul-Khiláfíyat, the Yanábiya-ul-
Ahkám (Yanābīʿu ʾl-Aḥkām), the Uyúm, and the Zubdat-ul-Ahkám. The
Kanz-ud-Dakáïk (Kanzu ʾd-Daqāʾiq), by An-Nasafí, is a book of great
reputation, principally derived from the Wáfí; and containing questions and
decisions according to the doctrines of Abú-Hanífah, Abú-Yusuf, Imám
Muhammad, Zufar, Sháfií, Málik, and others. Many commentaries have
been written on the last mentioned work; the most famous of them is the
Bahr-ur-Ráïk (al-Baḥru ʾr-Rāʾiq), which may, indeed, almost be said to
have superseded its original, at least in India. The Bahr-ur-Ráïk is by Zainu-
ul-Aábidín Bin Nujaim-ul Misrí (Ibn Najīm), a.h. 970. The Multaka-al-
Abhár (Multaqa ʾl-Abḥār), by Shaikh Ibráhím Bin Muhammad al-Halabí,
who died a.h. 956, is a universal code of Muhammadan law. It gives the
different opinions or doctrines of Abú Hanífah, Málik, Sháfií, and Hanbal,
the chief Mujtahid Imáms and the founders of the four great sects of Sunnís,
and illustrates them by those of the principal jurisconsults of the school of
Abú Hanífah. It is more frequently referred to as an authority throughout
Turkey, than any other treatise on jurisprudence.
“The digests inculcating exclusively the doctrines of each of the said four
great sects are, indeed, numerous, though a very few of them which
maintain the doctrines of the Málikí, or Sháfií, or Hanbalí sects are used in
India. Digests written by Málik or any of his followers are scarcely found in
India.
“Of the digests maintaining the Málikí doctrines, two have lately appeared
in France (by M. Vincent, 1842; M. Perron, 1843). The first work of Sháfií,
entitled the Usúl (Uṣūl), or fundamentals, which contains the principles of
the Muhammadan civil and canon law, may be classed as a digest. The
Muk͟ htasar, the Mansúr, the Rasáïl-ul-Muatabirah (ar-Rasāʾilu ʾl-
Muʿtabarah), and the Kitáb-ul-Wasáïk, are amongst the other works written
by Abú Ibráhím Bin Yahiyá-al-Muzani, a distinguished disciple of Sháfií,
and a native of Egypt (a.h. 264), and are according to the doctrines of
Sháfií. The works by Ibnu Hambal and his followers are few in number, and
rare.
“The followers of the Hanífí sect, which obtains most commonly amongst
the Muhammadans of India, have, like others, divided their law into two
general branches or parts, respectively called the Fikah (law, religious and
secular), and Faráïz (the succession to, and division of, inheritance).
“The works which are on Fikah (Fiqh), and which are considered as the
chief authorities of the Hanífí sect, are the following:—Abú Hanífah’s own
digest of law, entitled the Fikah-ul-Akbar (al-Fiqhu ʾl-Akbar). This is the
first in rank, and has been commented upon by various writers, many of
whom are mentioned by Hájí Khalífah. The doctrines of that great lawyer,
however, are sometimes qualified or dissented from by his two famous
pupils, Abú Yusuf and Imám Muhammad. The work entitled Adab-ul-Kází,
which treats of the duties of a magistrate, is known to have been written by
Abú Yusuf. Save and except this, no other work appears to have been
composed by him. He, however, is said to have supplied his notes to his
pupil Imám Muhammad, who made use of them in the composition of his
own works. The works of Imám Muhammad are six in number, five of
which are, in common, entitled the Záhir-ur-Rawáyát (Z̤ āhiru ʾr-Rawāyāt,
conspicuous traditions or reports). They are: 1. The Jámi-ul-Kabír (al-
Jāmiʿu ʾl-Kabīr); 2. Jámi-us-Saghír (al-Jāmiʿu ʾṣ-Ṣag͟ hīr); 3. Mabsút fí
Farú-ul-Hanífiyát; 4. Ziyádát fí Farú-ul-Hanífiyát; and 5. Siyar al-Kabír wa
Saghír. The Nawádir, the sixth and last of the known compositions of Imám
Muhammad, though not so highly esteemed as the others, is still greatly
respected as an authority.
“The next authorities among the Hanafís, after the founder of their sect and
his two disciples, are the Imám Zufar Bin al-Hazíl who was chief judge at
Basrah, where he died (a.h. 158), and Hasan Bin Ziyád. These lawyers are
said to have been contemporaries, friends, and scholars of Abú-Hanífah,
and their works are quoted here as authorities for Abú Hanífah’s doctrines,
more especially when the two disciples are silent. The most celebrated of
the several treatises known by the name of Adáb-ul Kází was written by
Abú Bakr Ahmad Bin ʿUmar ul-Khassáf (a.h. 261). An abridgement of the
Hanafí doctrines, called the Mukhtasar ut-Tahaví, was written by Abú
Jaafar Ahmad Bin Muhammad at-Tahaví (a.h. 331), who wrote also a
commentary on the Jámi us-Saghír of Imám Muhammad.
“The Vikáyah (al-Wiqāyah), which was written in the seventh century of the
Hijrah by Burhán ash-Shariyat Mahmúd, is an elementary work to enable
the student to study and understand the Hidáyah. The Vikáyah is printed,
and invariably studied, with its celebrated commentary, the Sharh ul-
Vikáyah, written by Ubaidullah Bin Masuúd, who died a.h. 745. The Sharh-
ul-Vikáyah contains the text of the Vikáyah, with a gloss most perspicuously
explanatory and illustrative; so much so, that those chapters of it which treat
of marriage, dower, and divorce, are studied in the Madrassahs of India in
preference to the Hidáyah itself. There are also other commentaries on the
Vikáyah, but not so useful as the above. On the Sharh-ul-Vikáyah, again,
there is an excellent commentary, entitled the Chalpí, written by Akhí Yusuf
Bin Juníd, who was one of the then eight professors at Constantinople. This
work was commenced to be written about a.h. 891, and completed a.h.
901; and the whole of it was published in Calcutta a.h. 1245, and extracts
therefrom have been printed.
“Many works have been written according to the doctrines of Abú Hanífah
in the Turkish Empire, and are received there as authorities. The most
celebrated of those is the Multaka-ul-Abhár, by Shaikh Ibráhím Bin
Muhammad al-Halabí, the Durr-ul-Hukkám, by Mullah Khusrú, Kánún-
námai-Jazá, a tract on penal laws, &c.
“Of the books on the law of inheritance according to the Hanífí doctrines,
the most celebrated, and the one invariably consulted in India, is the
Sirájiyyah (as-Sirājīyah), which is also called the Faráïz-us-Sajáwandí,
being, as it is, composed by Siráj-ud-Dín Muhammad bin Abd-ur-Rashíd
as-Sajáwandí. This work has been commented upon by a vast number of
writers, upwards of forty being enumerated in the Kashf-uz-Zunún by Hájí
Khalífah. The most celebrated of these commentaries, and the most
generally used to explain the text of the Sirájiyyah, is the Sharífiyyah (ash-
Sharīfīyah), by Sayyid Sharif Ali Bin Muhammad Al-Jurjání (who died a.h.
814).
“Of the Fatáwás of the Hanífí doctrines the following are generally known
in India. The Khulásat ul-Fatáwá (K͟ hulāṣatu ʾl-Fatāwā), by Imám Iftikhar-
ud-Dín Tahir Bin Ahmad Al-Bukhárí, who died a.h. 542, is a select
collection of decisions of great authority. The Zakhírat-ul-Fatáwá
(Ẕak͟ hīratu ʾl-Fatāwā), sometimes called the Zakhírat-ul-Burhániyah, by
Burhán-ud-Dín Bin Mázah al-Bukhárí, the author of the Muhít-ul-Burhání,
is also a celebrated, though not a large, collection of decisions, principally
taken from the Muhít. The Fatáwá-i-Kází Khán, by Imám Fakhr-ud-Dín
Hasan Bin Mansúr al-Uʾzjandí al-Farghání, commonly called Kází Khán,
who died a.h. 592, is a work held in very high authority. It is replete with
cases of common occurrence, and is, therefore, of great practical utility,
more especially as many of the decisions are illustrated by proofs and
reasoning on which they are founded. The two works entitled the Fusúl-ul-
Isturúshí and Fusúl-ul-Imádíah, were incorporated in a collection entitled
the Jámi-ul-Fusúlain, which is a work of some celebrity. It was compiled
by Badr-ud-Dín Muhammad, known by the name of Ibn-ul-Kází
Simáwanah (a.h. 823). The Fatáwá az-Zahíriyah, which contains decisions
collected partly from the Khizánat-ul-Wákiyát, was written by Jahír-ud-Dín
Abú Bakr Muhammad Bin Ahmad al-Bukhárí (a.h. 619). The Kuniyat-ul-
Muniyat is a collection of decisions of considerable authority by Mukhtár
Bin Mahmúd Bin Muhammad as-Záhidí Abú-ur-Rijá al-Ghazmíní,
surnamed Najm-ud-Dín, who died a.h. 658. An-Navaví, the author of the
biographical dictionary entitled the Tahzíb-ul-Asmá (Tahẕību ʾl-Asmāʾ),
who died a.h. 677, made a collection of decisions of some note, which is
called the Fatáwá an-Navaví. He also composed a smaller work of the same
nature, entitled al-Masáïl-ul-Muhimmat (ʿUyūn al-Masāʾili ʾl-Muhimmah),
arranged in the manner of question and answer. The Khizánat-ul-Muftiyín,
by Imám Husain Bin Muhammad as-Samaání, who completed his work in
a.h. 740, contains a large collection of decisions, and is a book of some
authority in India. The Khizánat-ul-Fatáwá, by Ahmad Bin Muhammad
Abú Bakr al-Hanafí, is a collection of decisions made towards the end of
the eighth century of the Hijrah, and comprises questions of rare
occurrence. The Fatáwá Tátár-Khániyah was originally a large collection
of Fatáwás, in several volumes, by Imám Aálim Bin Alá al-Hanafí, taken
from the Muhít-ul-Burhání, the Zakhírat, the Khániyah, and the Zahíriyah.
Afterwards, however, a selection was made from these decisions by Imám
Ibráhím Bin Muhammad al-Halabí, who died a.h. 956, and an epitome was
thus formed, which is in one volume, and still retains the title of Tátár-
Khániyah. The Fatáwá-i-Ahl-us-Samarkand, is a collection of the decisions
of those learned men of the city of Samarkand who are omitted, or lightly
passed over, in the Fatáwá-Tátár Khániyah and the Jámi-ul-Fusúlain, to
both of which works it may be considered a supplement. The Fatáwá az-
Zainíyah contains decisions by Zain ul-Aabidín Ibrahím Bin Nujaim al-
Misrí, the author of the Bahr-ur-Ráïk and the Ashbah wa-an-Nazáïr. They
were collected by his son Ahmad (about a.h. 970). The Fatáwá al-Ankiraví,
a collection of decisions of al-Ankiraví by Shaikh-ul-Islám Muhammad Bin
al-Husain, who died a.h. 1098, is a work of authority. The Fatáwá
Hammádiyah, though it seems to be a modern compilation, is a work of
considerable authority.
“Mr. Harrington, in his analysis (vol. i. 2nd ed.), mentions a few other
books of Fatáwá, viz. the Fatáwá Bazázíah, the Fatáwá Nakshbandiyah, the
Mukhtár-ul-Fatáwá, and the Fatáwá Karákhání. The last of these he
describes to be a Persian compilation, the cases included in which were
collected by Mullah Sadar-ud-Dín Bin Yákúb, and arranged some years
after his death by Kará Khán, in the reign of Sultán Alá-ud-Dín.
“Of the Fatwás which treat both of the Fikah and Faráïz, two are most
generally used in India. These are the Fatáwá Sirájiyyah and Fatáwá
Alamgírí. The Fatáwá Sirájiyyah, with some principles, contains a
collection of decisions on cases which do not generally occur in other
books. The Fatáwá Alamgírí, with opinions and precepts of law, contains an
immense number of law cases. This work, from its comprehensive nature, is
applicable to almost every case that arises involving points of the Hanífí
doctrines. Although opinions of modern compilers are not esteemed as of
equal authority with those of the older writers on jurisprudence, yet being
composed by a great number of the most learned lawyers of the age, and by
order of the then greatest person of the realm, the Emperor Aurungzeb
Alamgír (by whose name the book is designated), the Fatáwá Alamgírí is
esteemed as a very high authority in India; and containing, as it does,
decisions on cases of any shape based upon unquestionable authorities, this
book is here referred to more frequently than any other work of a similar
nature, and has not up to this day been surpassed by any work, except
perhaps, by the Radd-ul-Muhtár, already spoken of. During the long rule of
the Muhammadans in India, the Fatáwá Alamgírí alone appears to have
been translated into Persian, by order of Zéb-un-nisá, daughter of the
Emperor Aurungzeb Alamgír. Since the establishment of the British
Government in India, the books of Jináyah and Hudúd from the Fatáwá
Alamgírí were translated into Persian, under the direction of the Council of
the College of Fort William in Calcutta, by the then Kází-ul-Kuzzát,
Muhammad Najm ud-Dín Khán, and were published in the year 1813,
together with a Persian treatise on Tázírát, by the same author.
“In the same year the book on Tázírát from the Durr-ul-Mukhtár was
translated, printed, and published, by Moulavi Muhammad Khalíl-ud-Dín,
under the orders of Mr. Harrington, the then Chief Judge of the late Sudder
Dewany Adawlut.
“The Hidáyah was translated into Persian by four of the most learned
Moulavis of that time and of this country (India). Unfortunately, however,
the learned translators have, in the body of the book, inserted many things
by way of explanatory remarks and illustrative expositions, instead of
subjoining them in the form of notes. Furthermore, they have, in a
considerable degree, deviated from the original. For all these reasons, we
are warranted to say, that the Persian version of the Hidáyah does not
represent a true picture of the original.
“Of the digests of Muhammadan law in English, the first appears to be the
chapter on criminal law of the Muhammadans as modified by regulations.
This is incorporated in Harrington’s Analysis of Bengal Regulations. An
abstract of Muhammadan law, which is from the pen of Lieutenant-Colonel
Vans Kennedy, will be found in the Journal of the Royal Asiatic Society.
‘This work,’ says Mr. Morley, ‘is well worthy the attention of the student.’
The work entitled the Principles and Precedents of Muhammadan Law,
written by Mr. (afterwards Sir) William Hay Macnaghten, is the clearest or
easiest, if not the amplest or sufficient, work on that law hitherto written in
English. Mr. Neil Baillie’s Muhammadan Law of Inheritance, according to
Abú Hanífah and his followers, with appendix containing authorities from
the original Arabic, is an excellent work of the kind. The treatise on
inheritance, gift, will, sale, and mortgage, compiled by Mr. F. E. Elberling,
a Danish judge at Serampore, in the year 1844, contains principles of
Muhammadan law, with those of the other laws, as used in India.
“In the year 1865, Mr. Neil Baillie, the author of the work already
mentioned, completed and published a digest of Muhammadan law on all
the subjects to which the Muhammadan law is usually applied by the
British Courts of Justice in India. It gives translations of almost all the
principles and some of the cases contained in the Fatáwá Alamgírí, the
great digest of Muhammadan law in India, and quotes occasionally other
available authorities. Being generally close to the original, and fully dealing
with the subjects it treats of, this work must be said to be authentic, as well
as the amplest of the digests of Muhammadan law hitherto written in
English according to the doctrines of the Hanífí sect.” (See the Tagore Law
Lectures, 1873, by Shama Churun Sircar; Thacker, Spink & Co., Calcutta.)
II.—The Shīʿahs, although they are divided amongst themselves into
numerous sects which differ from each other in various points of religious
belief, are unanimous in rejecting the collections of Traditions of the
Sunnīs. The Sunnīs arrogate to themselves the title of Traditionists, but this
does not imply that the Shīʿahs do not receive the Ḥadīs̤ , but merely that
they reject the “six correct books” of their opponents.
The works on Ḥadīs̤ compiled by the Shīʿahs are very numerous, and they
maintain that they have earlier and more authentic collections than those of
the Sunnīs. They say that in the time of al-Ḥasan and al-Ḥusain, a certain
person who was grandfather to ʿAbdu ʾllāh ibn ʿAlī ibn Abī Shuʿbah al-
Ḥalabī, collected traditions and gave them to his grandson for careful
record. This record was verified and corrected by Imām Jaʿfar aṣ-Ṣadīq. The
Sunnī doctor, Abū Ḥanīfah, was a pupil of this distinguished personage in
his earlier days, but afterwards separated from him and established a school
of his own.
Mr. Shama Churun Sircar, Tagore Professor of Law, has also reviewed the
Shīʿah, or Imamīyah, law books, and we are indebted to him for the
following résumé:—
“One of the earliest works on civil and criminal laws was written by
Abdullah Bin Alí al Halabí. But it does not appear that any of his legal
compositions are extant.
“The chief works on law, written by Abú Jaafar Muhammad at-Túsí (Abū
Jaʿfar Muḥammad at̤ -T̤ ūsī), are the Mabsút, the Khiláf, the Niháyah, and the
Muhít. These works are held in great estimation, and he is considered one of
the highest authorities in law. The Risálat-i-Jaafariyah is likewise a legal
treatise by at-Túsí, which is frequently quoted.
“A work on the law of inheritance, entitled the al-Ijáz fí al-Faráïz has been
left by Abú Jaafar Muhammad at-Túsí in addition to his general works on
the Kurán, the Hadís and jurisprudence.
“The best known and most esteemed works on the law of inheritance are the
Ihtijáj ush-Shíah, by Saád Bin Abd-ullah al-Asharí, the Kitáb ul-Mawáris,
by Abú al-Hasan Alí Bábavaih; the Hamal ul-Faráïz and the Faráïz ush-
Shariyah, by Shaikh Mufíd. The Sharáya ul-Islám, which, as already stated,
is one of the highest authorities on the Shíah law, contains also a chapter on
Inheritance.
Of all the above-mentioned books on civil and criminal laws, those that are
commonly referred to in India are the following: The Sharáya ul-Islám,
Rouzat-ul-Ahkám, Sharah-i-Lumá, Mafátíh, Tahrír, and Irshád ul-Azhán.
“Of the books on this branch of Muhammadan law, only that part of the
Sharáya ul-Islám which treats of the forensic law has been translated,
though not fully, by Mr. Neil Baillie. A considerable part of the digest
compiled under the superintendence of Sir William Jones (as already
noticed) was translated by Colonel Baillie, out of which the chapter on
Inheritance has been printed by Mr. Neil Baillie at the end of the second
part of his digest of Muhammadan law. Although the chapter above alluded
to is copious, yet it must be remarked that it is not so clear and useful as the
Sharáya-ul-Islám and Rouzat ul-Ahkám.” (See Tagore Law Lectures, 1874,
the Imámiyah Code, by Shama Churun Sircar; Thacker, Spink and Co.,
Calcutta.)
LEGACY. [wills.]
According to the Sunnīs and Shīʿahs, and according to the teaching of the
Qurʾān itself, the shortest period of gestation recognised by law is six
months, and consequently a child born any time after six months from the
date of marriage has a claim to legitimacy. Amongst the Sunnīs, a simple
denial of the paternity of the child so born would not take away its status of
legitimacy. But the Shīʿahs hold that if a man get a woman with child and
then marry her, and she give birth to the child within six months after
marriage, legitimacy is not established.
[Under the old Roman law, it was ten months. In the Code Napoleon, article
312, it is three hundred days. Under the Jewish law, the husband had the
absolute right of disavowal. See Code Rabbinique, vol. ii. p. 63.]
The Muḥammadan law, like the English law, does not recognise the
legitimation of antenuptial children. Whereas, according to French and
Scotch law, such children are legitimated by the subsequent marriage of the
parents.
In Sunnī law, an invalid marriage does not affect the legitimacy of children
born from it. Nor does it in Shīʿah law; but the Shīʿah law demands proof
that such a marriage was a bona fide one, whilst the Ḥanafī code is not strict
on this point.
In the case of a divorce by liʿān [liʿan], the waladu ʾl-mulāʿanah, or “child
of imprecation,” is cut off from his right of inheritance from his father.
In the case of Liʿān, as in the other forms of divorce, the woman can claim
her dower.
ebookgate.com