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

C how to program Seventh Edition. Edition Deitel pdf download

The document provides information on various programming books available for download, including 'C How to Program Seventh Edition' by Paul Deitel and Harvey Deitel. It lists multiple programming titles across different languages and topics, along with links for instant digital downloads. Additionally, it includes details about the authors, publication rights, and a brief overview of the content covered in the 'C How to Program' book.

Uploaded by

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

C how to program Seventh Edition. Edition Deitel pdf download

The document provides information on various programming books available for download, including 'C How to Program Seventh Edition' by Paul Deitel and Harvey Deitel. It lists multiple programming titles across different languages and topics, along with links for instant digital downloads. Additionally, it includes details about the authors, publication rights, and a brief overview of the content covered in the 'C How to Program' book.

Uploaded by

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

C how to program Seventh Edition.

Edition Deitel
pdf download

https://ebookname.com/product/c-how-to-program-seventh-edition-
edition-deitel/

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


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

C How to Program 8th Edition Paul Deitel

https://ebookname.com/product/c-how-to-program-8th-edition-paul-
deitel/

Java How to Program 6th Edition Harvey Deitel & Paul


Deitel

https://ebookname.com/product/java-how-to-program-6th-edition-
harvey-deitel-paul-deitel/

Java How to Program Late Objects Version 8th Edition


Deitel

https://ebookname.com/product/java-how-to-program-late-objects-
version-8th-edition-deitel/

Changing relations achieving intimacy in a time of


social transition 1st Edition Robin Goodwin

https://ebookname.com/product/changing-relations-achieving-
intimacy-in-a-time-of-social-transition-1st-edition-robin-
goodwin/
Occidentalism The West in the Eyes of Its Enemies Ian
Buruma

https://ebookname.com/product/occidentalism-the-west-in-the-eyes-
of-its-enemies-ian-buruma/

AP Calculus BC 2014 2015 Edition Ma

https://ebookname.com/product/ap-calculus-bc-2014-2015-edition-
ma/

Progressions and Innovations in Model Driven Software


Engineering 1st Edition Vicente García Díaz

https://ebookname.com/product/progressions-and-innovations-in-
model-driven-software-engineering-1st-edition-vicente-garcia-
diaz/

Pricing Portfolio Credit Derivatives by Means of


Evolutionary Algorithms 1st Edition Svenja Hager
(Auth.)

https://ebookname.com/product/pricing-portfolio-credit-
derivatives-by-means-of-evolutionary-algorithms-1st-edition-
svenja-hager-auth/

Crohn s Disease Etiology Pathogenesis and Interventions


Etiology Pathogenesis and Interventions 1st Edition
Jack N. Cadwaller

https://ebookname.com/product/crohn-s-disease-etiology-
pathogenesis-and-interventions-etiology-pathogenesis-and-
interventions-1st-edition-jack-n-cadwaller/
The Complete Works of Rosa Luxemburg Volume II Economic
Writings 2 Luxemburg

https://ebookname.com/product/the-complete-works-of-rosa-
luxemburg-volume-ii-economic-writings-2-luxemburg/
Deitel® Series Page
How To Program Series (continued from previous column)
Visual Basic® 2010 How to Program
Android How to Program
Visual Basic® 2008 How to Program
C++ How to Program, 8/E
Visual C#® 2010 How to Program, 4/E
C How to Program, 7/E
Visual C#® 2008 How to Program, 3/E
Java™ How to Program, 9/E
Java™ How to Program, Late Objects Version, 8/E
Internet & World Wide Web How to Program, 5/E
Deitel® Developer Series
Visual C++® 2008 How to Program, 2/E AJAX, Rich Internet Applications and Web
Visual Basic® 2010 How to Program Development for Programmers
Visual C#® 2010 How to Program, 3/E Android for Programmers: An App-Driven
Approach
C++ for Programmers
Simply Series C# 2010 for Programmers
Simply C++: An App-Driven Tutorial Approach iPhone® for Programmers: An App-Driven Approach
Simply Java™ Programming: An App-Driven Java™ for Programmers, 2/e
Tutorial Approach JavaScript for Programmers
Simply C#: An App-Driven Tutorial Approach
Simply Visual Basic® 2010: An App-Driven LiveLessons Video Learning Products
Approach, 4/E
www.deitel.com/books/LiveLessons/

CourseSmart Web Books Android App Development Fundamentals


C++ Fundamentals
www.deitel.com/books/CourseSmart/
Java™ Fundamentals
C++ How to Program, 5/E, 6/E, 7/E & 8/E C# 2010 Fundamentals
Simply C++: An App-Driven Tutorial Approach iPhone® App Development Fundamentals
Java™ How to Program, 6/E, 7/E, 8/E & 9/E JavaScript Fundamentals
Simply Visual Basic 2010: An App-Driven Visual Basic Fundamentals
Approach, 4/E

To receive updates on Deitel publications, Resource Centers, training courses, partner offers and more,
please register for the free Deitel ® Buzz Online e-mail newsletter at:
www.deitel.com/newsletter/subscribe.html
and join the Deitel communities on Twitter®
@deitel
Facebook®
facebook.com/DeitelFan
and Google+
gplus.to/deitel
To communicate with the authors, send e-mail to:
deitel@deitel.com
For information on government and corporate Dive-Into® Series on-site seminars offered by Deitel &
Associates, Inc. worldwide, visit:
www.deitel.com/training/
or write to
deitel@deitel.com
For continuing updates on Prentice Hall/Deitel publications visit:
www.deitel.com
www.pearsonhighered.com/deitel/

Visit the Deitel Resource Centers that will help you master programming languages, software develop-
ment, Android and iPhone/iPad app development, and Internet- and web-related topics:
www.deitel.com/ResourceCenters.html
Paul Deitel
Deitel & Associates, Inc.
Harvey Deitel
Deitel & Associates, Inc.
Editorial Director: Marcia J. Horton
Editor-in-Chief: Michael Hirsch
Associate Editor: Carole Snyder
Vice President, Marketing: Patrice Jones
Marketing Manager: Yezan Alayan
Marketing Coordinator: Kathryn Ferranti
Vice President, Production: Vince O’Brien
Managing Editor: Jeff Holcomb
Associate Managing Editor: Robert Engelhardt
Operations Specialist: Lisa McDowell
Art Director: Anthony Gemmellaro
Cover Design: Paul Deitel, Harvey Deitel, Abbey Deitel, Anthony Gemmellaro
Cover Photo Credit: Excellent backgrounds/Shutterstock.com
Media Editor: Daniel Sandin
Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear
on page vi.

The authors and publisher of this book have used their best efforts in preparing this book. These efforts include the
development, research, and testing of the theories and programs to determine their effectiveness. The authors and pub-
lisher make no warranty of any kind, expressed or implied, with regard to these programs or to the documentation
contained in this book. The authors and publisher shall not be liable in any event for incidental or consequential dam-
ages in connection with, or arising out of, the furnishing, performance, or use of these programs.
Copyright © 2013, 2010, 2007, 2004, 2001 Pearson Education, Inc., publishing as Prentice Hall. All rights reserved.
Manufactured in the United States of America. This publication is protected by Copyright, and permission should be
obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any
form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to use
material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One
Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to 201-236-3290.
Many of the designations by manufacturers and sellers to distinguish their products are claimed as trademarks. Where
those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been
printed in initial caps or all caps.
Library of Congress Cataloging-in-Publication Data
Deitel, Paul J.
C : how to program / Paul Deitel, Deitel & Associates, Inc., Harvey Deitel, Deitel & Associates,
Inc., Abbey Deitel, Deitel & Associates, Inc. -- Seventh edition.
pages cm -- (How to program series)
ISBN 978-0-13-299044-8
1. C (Computer program language) 2. C++ (Computer program language) 3. Java (Computer program
language) I. Deitel, Harvey M., II. Deitel, Abbey. III. Title.
QA76.73.C15D44 2012
005.13'3--dc23
2011051087

10 9 8 7 6 5 4 3 2 1
ISBN-10: 0-13-299044-X
ISBN-13: 978-0-13-299044-8
In Memory of Dennis Ritchie,
creator of the C programming language
and co-creator of the UNIX operating system.
Paul and Harvey Deitel
Trademarks
DEITEL, the double-thumbs-up bug and DIVE INTO are registered trademarks of Deitel and Associates,
Inc.
MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS
ABOUT THE SUITABILITY OF THE INFORMATION CONTAINED IN THE DOCUMENTS
AND RELATED GRAPHICS PUBLISHED AS PART OF THE SERVICES FOR ANY PURPOSE.
ALL SUCH DOCUMENTS AND RELATED GRAPHICS ARE PROVIDED "AS IS" WITHOUT
WARRANTY OF ANY KIND. MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS HEREBY
DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THIS INFORMA-
TION, INCLUDING ALL WARRANTIES AND CONDITIONS OF MERCHANTABILITY,
WHETHER EXPRESS, IMPLIED OR STATUTORY, FITNESS FOR A PARTICULAR PURPOSE,
TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL MICROSOFT AND/OR ITS
RESPECTIVE SUPPLIERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PER-
FORMANCE OF INFORMATION AVAILABLE FROM THE SERVICES.
THE DOCUMENTS AND RELATED GRAPHICS CONTAINED HEREIN COULD INCLUDE
TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODI-
CALLY ADDED TO THE INFORMATION HEREIN. MICROSOFT AND/OR ITS RESPECTIVE
SUPPLIERS MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/
OR THE PROGRAM(S) DESCRIBED HEREIN AT ANY TIME. PARTIAL SCREEN SHOTS
MAY BE VIEWED IN FULL WITHIN THE SOFTWARE VERSION SPECIFIED.
Contents
Appendices E through H are PDF documents posted online at the book’s Companion
Website (located at www.pearsonhighered.com/deitel).

Preface xix

1 Introduction to Computers, the Internet


and the Web 1
1.1 Introduction 2
1.2 Computers and the Internet in Industry and Research 2
1.3 Hardware and Software 5
1.3.1 Moore’s Law 6
1.3.2 Computer Organization 6
1.4 Data Hierarchy 7
1.5 Programming Languages 9
1.6 The C Programming Language 10
1.7 C Standard Library 12
1.8 C++ and Other C-Based Languages 13
1.9 Object Technology 14
1.10 Typical C Program Development Environment 16
1.10.1 Phase 1: Creating a Program 16
1.10.2 Phases 2 and 3: Preprocessing and Compiling a C Program 16
1.10.3 Phase 4: Linking 18
1.10.4 Phase 5: Loading 18
1.10.5 Phase 6: Execution 18
1.10.6 Problems That May Occur at Execution Time 18
1.10.7 Standard Input, Standard Output and Standard Error Streams 18
1.11 Test-Driving a C Application in Windows, Linux and Mac OS X 19
1.11.1 Running a C Application from the Windows
Command Prompt 20
1.11.2 Running a C Application Using GNU C with Linux 22
1.11.3 Running a C Application Using GNU C with Mac OS X 25
1.12 Operating Systems 27
1.12.1 Windows—A Proprietary Operating System 28
1.12.2 Linux—An Open-Source Operating System 28
1.12.3 Apple’s Mac OS X; Apple’s iOS for iPhone®, iPad® and
iPod Touch® Devices 29
1.12.4 Google’s Android 29
viii Contents

1.13 The Internet and World Wide Web 30


1.14 Some Key Software Development Terminology 31
1.15 Keeping Up-to-Date with Information Technologies 33
1.16 Web Resources 34

2 Introduction to C Programming 40
2.1 Introduction 41
2.2 A Simple C Program: Printing a Line of Text 41
2.3 Another Simple C Program: Adding Two Integers 45
2.4 Memory Concepts 49
2.5 Arithmetic in C 50
2.6 Decision Making: Equality and Relational Operators 54
2.7 Secure C Programming 58

3 Structured Program Development in C 70


3.1 Introduction 71
3.2 Algorithms 71
3.3 Pseudocode 71
3.4 Control Structures 72
3.5 The if Selection Statement 74
3.6 The if…else Selection Statement 75
3.7 The while Repetition Statement 79
3.8 Formulating Algorithms Case Study 1: Counter-Controlled Repetition 80
3.9 Formulating Algorithms with Top-Down, Stepwise Refinement
Case Study 2: Sentinel-Controlled Repetition 82
3.10 Formulating Algorithms with Top-Down, Stepwise Refinement
Case Study 3: Nested Control Statements 89
3.11 Assignment Operators 93
3.12 Increment and Decrement Operators 93
3.13 Secure C Programming 96

4 C Program Control 114


4.1 Introduction 115
4.2 Repetition Essentials 115
4.3 Counter-Controlled Repetition 116
4.4 for Repetition Statement 117
4.5 for Statement: Notes and Observations 120
4.6 Examples Using the for Statement 121
4.7 switch Multiple-Selection Statement 124
4.8 do…while Repetition Statement 130
4.9 break and continue Statements 132
4.10 Logical Operators 134
4.11 Confusing Equality (==) and Assignment (=) Operators 137
Contents ix

4.12 Structured Programming Summary 138


4.13 Secure C Programming 143

5 C Functions 158
5.1 Introduction 159
5.2 Program Modules in C 159
5.3 Math Library Functions 160
5.4 Functions 162
5.5 Function Definitions 162
5.6 Function Prototypes: A Deeper Look 166
5.7 Function Call Stack and Stack Frames 169
5.8 Headers 172
5.9 Passing Arguments By Value and By Reference 173
5.10 Random Number Generation 174
5.11 Example: A Game of Chance 179
5.12 Storage Classes 182
5.13 Scope Rules 184
5.14 Recursion 187
5.15 Example Using Recursion: Fibonacci Series 191
5.16 Recursion vs. Iteration 194
5.17 Secure C Programming 197

6 C Arrays 216
6.1 Introduction 217
6.2 Arrays 217
6.3 Defining Arrays 218
6.4 Array Examples 219
6.5 Passing Arrays to Functions 232
6.6 Sorting Arrays 236
6.7 Case Study: Computing Mean, Median and Mode Using Arrays 239
6.8 Searching Arrays 244
6.9 Multidimensional Arrays 249
6.10 Variable-Length Arrays 256
6.11 Secure C Programming 259

7 C Pointers 277
7.1 Introduction 278
7.2 Pointer Variable Definitions and Initialization 278
7.3 Pointer Operators 279
7.4 Passing Arguments to Functions by Reference 282
7.5 Using the const Qualifier with Pointers 284
7.5.1 Converting a String to Uppercase Using a Non-Constant
Pointer to Non-Constant Data 287
x Contents

7.5.2 Printing a String One Character at a Time Using a


Non-Constant Pointer to Constant Data 288
7.5.3 Attempting to Modify a Constant Pointer to Non-Constant Data 290
7.5.4 Attempting to Modify a Constant Pointer to Constant Data 291
7.6 Bubble Sort Using Pass-by-Reference 291
7.7 sizeof Operator 294
7.8 Pointer Expressions and Pointer Arithmetic 297
7.9 Relationship between Pointers and Arrays 299
7.10 Arrays of Pointers 303
7.11 Case Study: Card Shuffling and Dealing Simulation 304
7.12 Pointers to Functions 309
7.13 Secure C Programming 314

8 C Characters and Strings 334


8.1 Introduction 335
8.2 Fundamentals of Strings and Characters 335
8.3 Character-Handling Library 337
8.3.1 Functions isdigit, isalpha, isalnum and isxdigit 338
8.3.2 Functions islower, isupper, tolower and toupper 340
8.3.3 Functions isspace, iscntrl, ispunct, isprint and isgraph 341
8.4 String-Conversion Functions 342
8.4.1 Function strtod 343
8.4.2 Function strtol 344
8.4.3 Function strtoul 345
8.5 Standard Input/Output Library Functions 346
8.5.1 Functions fgets and putchar 346
8.5.2 Function getchar 348
8.5.3 Function sprintf 349
8.5.4 Function sscanf 349
8.6 String-Manipulation Functions of the String-Handling Library 350
8.6.1 Functions strcpy and strncpy 351
8.6.2 Functions strcat and strncat 352
8.7 Comparison Functions of the String-Handling Library 353
8.8 Search Functions of the String-Handling Library 354
8.8.1 Function strchr 355
8.8.2 Function strcspn 356
8.8.3 Function strpbrk 357
8.8.4 Function strrchr 357
8.8.5 Function strspn 358
8.8.6 Function strstr 358
8.8.7 Function strtok 359
8.9 Memory Functions of the String-Handling Library 360
8.9.1 Function memcpy 361
8.9.2 Function memmove 362
8.9.3 Function memcmp 363
Contents xi

8.9.4 Function memchr 363


8.9.5 Function memset 364
8.10 Other Functions of the String-Handling Library 365
8.10.1 Function strerror 365
8.10.2 Function strlen 365
8.11 Secure C Programming 366

9 C Formatted Input/Output 379


9.1 Introduction 380
9.2 Streams 380
9.3 Formatting Output with printf 380
9.4 Printing Integers 381
9.5 Printing Floating-Point Numbers 382
9.6 Printing Strings and Characters 384
9.7 Other Conversion Specifiers 385
9.8 Printing with Field Widths and Precision 386
9.9 Using Flags in the printf Format Control String 388
9.10 Printing Literals and Escape Sequences 391
9.11 Reading Formatted Input with scanf 391
9.12 Secure C Programming 398

10 C Structures, Unions, Bit Manipulation and


Enumerations 405
10.1 Introduction 406
10.2 Structure Definitions 406
10.2.1 Self-Referential Structures 407
10.2.2 Defining Variables of Structure Types 407
10.2.3 Structure Tag Names 408
10.2.4 Operations That Can Be Performed on Structures 408
10.3 Initializing Structures 409
10.4 Accessing Structure Members 409
10.5 Using Structures with Functions 411
10.6 typedef 411
10.7 Example: High-Performance Card Shuffling and Dealing Simulation 412
10.8 Unions 415
10.8.1 Union Declarations 415
10.8.2 Operations That Can Be Performed on Unions 415
10.8.3 Initializing Unions in Declarations 416
10.8.4 Demonstrating Unions 416
10.9 Bitwise Operators 417
10.9.1 Displaying an Unsigned Integer in Bits 418
10.9.2 Making Function displayBits More Scalable and Portable 420
10.9.3 Using the Bitwise AND, Inclusive OR, Exclusive OR and
Complement Operators 420
xii Contents

10.9.4 Using the Bitwise Left- and Right-Shift Operators 423


10.9.5 Bitwise Assignment Operators 425
10.10 Bit Fields 426
10.11 Enumeration Constants 429
10.12 Secure C Programming 431

11 C File Processing 441


11.1 Introduction 442
11.2 Files and Streams 442
11.3 Creating a Sequential-Access File 443
11.4 Reading Data from a Sequential-Access File 448
11.5 Random-Access Files 452
11.6 Creating a Random-Access File 453
11.7 Writing Data Randomly to a Random-Access File 455
11.8 Reading Data from a Random-Access File 458
11.9 Case Study: Transaction-Processing Program 459
11.10 Secure C Programming 465

12 C Data Structures 476


12.1 Introduction 477
12.2 Self-Referential Structures 478
12.3 Dynamic Memory Allocation 478
12.4 Linked Lists 479
12.4.1 Function insert 485
12.4.2 Function delete 487
12.4.3 Function printList 488
12.5 Stacks 488
12.5.1 Function push 492
12.5.2 Function pop 492
12.5.3 Applications of Stacks 493
12.6 Queues 494
12.6.1 Function enqueue 498
12.6.2 Function dequeue 499
12.7 Trees 500
12.7.1 Function insertNode 504
12.7.2 Traversals: Functions inOrder, preOrder and postOrder 504
12.7.3 Duplicate Elimination 505
12.7.4 Binary Tree Search 505
12.7.5 Other Binary Tree Operations 505
12.8 Secure C Programming 506

13 C Preprocessor 517
13.1 Introduction 518
13.2 #include Preprocessor Directive 518
Contents xiii

13.3 #define Preprocessor Directive: Symbolic Constants 519


13.4 #define Preprocessor Directive: Macros 519
13.5 Conditional Compilation 521
13.6 #error and #pragma Preprocessor Directives 522
13.7 # and ## Operators 523
13.8 Line Numbers 523
13.9 Predefined Symbolic Constants 523
13.10 Assertions 524
13.11 Secure C Programming 524

14 Other C Topics 529


14.1 Introduction 530
14.2 Redirecting I/O 530
14.3 Variable-Length Argument Lists 531
14.4 Using Command-Line Arguments 533
14.5 Notes on Compiling Multiple-Source-File Programs 534
14.6 Program Termination with exit and atexit 536
14.7 Suffixes for Integer and Floating-Point Literals 537
14.8 Signal Handling 538
14.9 Dynamic Memory Allocation: Functions calloc and realloc 540
14.10 Unconditional Branching with goto 541

15 C++ as a Better C; Introducing Object


Technology 547
15.1 Introduction 548
15.2 C++ 548
15.3 A Simple Program: Adding Two Integers 549
15.4 C++ Standard Library 551
15.5 Header Files 552
15.6 Inline Functions 554
15.7 References and Reference Parameters 556
15.8 Empty Parameter Lists 561
15.9 Default Arguments 561
15.10 Unary Scope Resolution Operator 563
15.11 Function Overloading 564
15.12 Function Templates 567
15.13 Introduction to C++ Standard Library Class Template vector 570
15.14 Introduction to Object Technology and the UML 576
15.15 Wrap-Up 579

16 Introduction to Classes, Objects and Strings 586


16.1 Introduction 587
16.2 Defining a Class with a Member Function 587
xiv Contents

16.3 Defining a Member Function with a Parameter 590


16.4 Data Members, set Functions and get Functions 593
16.5 Initializing Objects with Constructors 599
16.6 Placing a Class in a Separate File for Reusability 603
16.7 Separating Interface from Implementation 606
16.8 Validating Data with set Functions 612
16.9 Wrap-Up 617

17 Classes: A Deeper Look, Part 1 623


17.1 Introduction 624
17.2 Time Class Case Study 625
17.3 Class Scope and Accessing Class Members 632
17.4 Separating Interface from Implementation 633
17.5 Access Functions and Utility Functions 634
17.6 Time Class Case Study: Constructors with Default Arguments 637
17.7 Destructors 642
17.8 When Constructors and Destructors Are Called 643
17.9 Time Class Case Study: A Subtle Trap—Returning a Reference to
a private Data Member 646
17.10 Default Memberwise Assignment 649
17.11 Wrap-Up 652

18 Classes: A Deeper Look, Part 2 658


18.1 Introduction 659
18.2 const (Constant) Objects and const Member Functions 659
18.3 Composition: Objects as Members of Classes 667
18.4 friend Functions and friend Classes 673
18.5 Using the this Pointer 675
18.6 static Class Members 680
18.7 Proxy Classes 685
18.8 Wrap-Up 689

19 Operator Overloading; Class string 695


19.1 Introduction 696
19.2 Using the Overloaded Operators of Standard Library Class string 697
19.3 Fundamentals of Operator Overloading 700
19.4 Overloading Binary Operators 701
19.5 Overloading the Binary Stream Insertion and Stream Extraction Operators 702
19.6 Overloading Unary Operators 706
19.7 Overloading the Unary Prefix and Postfix ++ and -- Operators 707
19.8 Case Study: A Date Class 708
19.9 Dynamic Memory Management 713
Contents xv

19.10 Case Study: Array Class 715


19.10.1 Using the Array Class 716
19.10.2 Array Class Definition 719
19.11 Operators as Member Functions vs. Non-Member Functions 727
19.12 Converting between Types 727
19.13 explicit Constructors 729
19.14 Building a String Class 731
19.15 Wrap-Up 732

20 Object-Oriented Programming: Inheritance 743


20.1 Introduction 744
20.2 Base Classes and Derived Classes 744
20.3 protected Members 747
20.4 Relationship between Base Classes and Derived Classes 747
20.4.1 Creating and Using a CommissionEmployee Class 748
20.4.2 Creating a BasePlusCommissionEmployee Class Without
Using Inheritance 752
20.4.3 Creating a CommissionEmployee–BasePlusCommissionEmployee
Inheritance Hierarchy 758
20.4.4 CommissionEmployee–BasePlusCommissionEmployee Inheritance
Hierarchy Using protected Data 763
20.4.5 CommissionEmployee–BasePlusCommissionEmployee Inheritance
Hierarchy Using private Data 766
20.5 Constructors and Destructors in Derived Classes 771
20.6 public, protected and private Inheritance 771
20.7 Software Engineering with Inheritance 772
20.8 Wrap-Up 773

21 Object-Oriented Programming: Polymorphism 778


21.1 Introduction 779
21.2 Introduction to Polymorphism: Polymorphic Video Game 780
21.3 Relationships Among Objects in an Inheritance Hierarchy 780
21.3.1 Invoking Base-Class Functions from Derived-Class Objects 781
21.3.2 Aiming Derived-Class Pointers at Base-Class Objects 784
21.3.3 Derived-Class Member-Function Calls via Base-Class Pointers 785
21.3.4 Virtual Functions 787
21.4 Type Fields and switch Statements 793
21.5 Abstract Classes and Pure virtual Functions 793
21.6 Case Study: Payroll System Using Polymorphism 795
21.6.1 Creating Abstract Base Class Employee 796
21.6.2 Creating Concrete Derived Class SalariedEmployee 800
21.6.3 Creating Concrete Derived Class CommissionEmployee 802
21.6.4 Creating Indirect Concrete Derived Class
BasePlusCommissionEmployee 804
21.6.5 Demonstrating Polymorphic Processing 806
xvi Contents

21.7 (Optional) Polymorphism, Virtual Functions and Dynamic Binding


“Under the Hood” 810
21.8 Case Study: Payroll System Using Polymorphism and Runtime Type
Information with Downcasting, dynamic_cast, typeid and type_info 813
21.9 Virtual Destructors 817
21.10 Wrap-Up 817

22 Templates 823
22.1 Introduction 824
22.2 Function Templates 824
22.3 Overloading Function Templates 827
22.4 Class Templates 828
22.5 Nontype Parameters and Default Types for Class Templates 834
22.6 Wrap-Up 835

23 Stream Input/Output 839


23.1 Introduction 840
23.2 Streams 841
23.2.1 Classic Streams vs. Standard Streams 841
23.2.2 iostream Library Headers 842
23.2.3 Stream Input/Output Classes and Objects 842
23.3 Stream Output 845
23.3.1 Output of char * Variables 845
23.3.2 Character Output Using Member Function put 845
23.4 Stream Input 846
23.4.1 get and getline Member Functions 846
23.4.2 istream Member Functions peek, putback and ignore 849
23.4.3 Type-Safe I/O 849
23.5 Unformatted I/O Using read, write and gcount 849
23.6 Introduction to Stream Manipulators 850
23.6.1 Integral Stream Base: dec, oct, hex and setbase 851
23.6.2 Floating-Point Precision (precision, setprecision) 851
23.6.3 Field Width (width, setw) 853
23.6.4 User-Defined Output Stream Manipulators 854
23.7 Stream Format States and Stream Manipulators 856
23.7.1 Trailing Zeros and Decimal Points (showpoint) 856
23.7.2 Justification (left, right and internal) 857
23.7.3 Padding (fill, setfill) 859
23.7.4 Integral Stream Base (dec, oct, hex, showbase) 860
23.7.5 Floating-Point Numbers; Scientific and Fixed Notation
(scientific, fixed) 861
23.7.6 Uppercase/Lowercase Control (uppercase) 862
23.7.7 Specifying Boolean Format (boolalpha) 862
23.7.8 Setting and Resetting the Format State via Member
Function flags 863
Contents xvii

23.8 Stream Error States 864


23.9 Tying an Output Stream to an Input Stream 866
23.10 Wrap-Up 867

24 Exception Handling: A Deeper Look 876


24.1 Introduction 877
24.2 Example: Handling an Attempt to Divide by Zero 877
24.3 When to Use Exception Handling 883
24.4 Rethrowing an Exception 884
24.5 Processing Unexpected Exceptions 885
24.6 Stack Unwinding 886
24.7 Constructors, Destructors and Exception Handling 888
24.8 Exceptions and Inheritance 888
24.9 Processing new Failures 889
24.10 Class unique_ptr and Dynamic Memory Allocation 892
24.11 Standard Library Exception Hierarchy 894
24.12 Wrap-Up 896

A Operator Precedence Charts 902

B ASCII Character Set 906

C Number Systems 907


C.1 Introduction 908
C.2 Abbreviating Binary Numbers as Octal and Hexadecimal Numbers 911
C.3 Converting Octal and Hexadecimal Numbers to Binary Numbers 912
C.4 Converting from Binary, Octal or Hexadecimal to Decimal 912
C.5 Converting from Decimal to Binary, Octal or Hexadecimal 913
C.6 Negative Binary Numbers: Two’s Complement Notation 915

D Game Programming: Solving Sudoku 920


D.1 Introduction 920
D.2 Deitel Sudoku Resource Center 921
D.3 Solution Strategies 921
D.4 Programming Sudoku Puzzle Solvers 925
D.5 Generating New Sudoku Puzzles 926
D.6 Conclusion 928

Appendices on the Web 929

Index 930
xviii Contents

Appendices E through H are PDF documents posted online at the book’s Companion
Website (located at www.pearsonhighered.com/deitel).

E Sorting: A Deeper Look

F Introduction to the New C Standard

G Using the Visual Studio Debugger

H Using the GNU Debugger


Preface
Welcome to the C programming language—and to C++, too! This book presents leading-
edge computing technologies for college students, instructors and software development
professionals.
At the heart of the book is the Deitel signature “live-code approach.” We present con-
cepts in the context of complete working programs, rather than in code snippets. Each
code example is followed by one or more sample executions. Read the online Before You
Begin section (www.deitel.com/books/chtp7/chtp7_BYB.pdf) to learn how to set up
your computer to run the hundreds of code examples. All the source code is available at
www.deitel.com/books/chtp7/ and www.pearsonhighered.com/deitel. Use the source
code we provide to run every program as you study it.
We believe that this book and its support materials will give you an informative, chal-
lenging and entertaining introduction to C. As you read the book, if you have questions,
send an e-mail to deitel@deitel.com—we’ll respond promptly. For book updates, visit
www.deitel.com/books/chtp7/, join our communities on Facebook (www.deitel.com/
deitelfan), Twitter (@deitel) and Google+ (gplus.to/deitel), and subscribe to the
Deitel ® Buzz Online newsletter (www.deitel.com/newsletter/subscribe.html).

New and Updated Features


Here are some key features of C How to Program, 7/e:
• Coverage of the New C standard. The previous edition of the book conformed to
“standard C” and included a detailed appendix on the C99 standard. The New
C Standard was approved just before C How to Program, 7/e went to publication.
The new standard incorporates both C99 and the more recent C1X—now re-
ferred to as C11 or simply “the C standard” since its approval in 2011. Support
for the new standard varies by compiler. The vast majority of our readership uses
either the GNU gcc compiler—which supports several of the key features in the
new standard—or the Microsoft Visual C++ compiler. Microsoft supports only
a limited subset of the features that were added to C in C99 and C11—primarily
the features that are also required by the C++ standard. To accommodate all of
our readers, we placed the discussion of the new standard in optional, easy-to-use-
or-omit sections and in Appendix F, Introduction to the New C Standard. We’ve
also replaced various deprecated capabilities with newer preferred versions as a re-
sult of the new C standard.
• New Chapter 1. The new Chapter 1 engages students with intriguing facts and fig-
ures to get them excited about studying computers and computer programming.
The chapter includes a table of some of the research made possible by computers
and the Internet, current technology trends and hardware discussion, the data hier-
archy, a new section on social networking, a table of business and technology pub-
xx Preface

lications and websites that will help you stay up to date with the latest technology
news and trends, and updated exercises. We’ve included test-drives that show how
to run a command-line C program on Microsoft Windows, Linux and Mac OS X.
• Secure C Programming Sections. We’ve added notes about secure C programming
to many of the C programming chapters. We’ve also posted a Secure C Program-
ming Resource Center at www.deitel.com/SecureC/. For more details, see the sec-
tion “A Note About Secure C Programming” in this Preface.
• Focus on Performance Issues. C (and C++) are favored by designers of perfor-
mance-intensive applications such as operating systems, real-time systems, em-
bedded systems and communications systems, so we focus intensively on
performance issues.
• “Making a Difference” Exercise Sets. We encourage you to use computers and the
Internet to research and solve problems that really matter. These exercises are
meant to increase awareness of important issues the world is facing. We hope
you’ll approach them with your own values, politics and beliefs.
• All Code Tested on Windows and Linux. We’ve tested every example and exercise
program using Visual C++ and GNU gcc in Windows and Linux, respectively.
• Updated Coverage of C++ and Object-Oriented Programming. We updated
Chapters 15–24 on object-oriented programming in C++ with material from our
textbook C++ How to Program, 8/e.
• Sorting: A Deeper Look. Sorting places data in order, based on one or more sort
keys. We begin our presentation of sorting with a simple algorithm in Chapter 6—
in Appendix E, we present a deeper look. We consider several algorithms and com-
pare them with regard to their memory consumption and processor demands. For
this purpose, we introduce Big O notation, which indicates how hard an algorithm
may have to work to solve a problem. Through examples and exercises, Appendix E
discusses the selection sort, insertion sort, recursive merge sort, recursive selection
sort, bucket sort and recursive Quicksort. Sorting is an interesting problem because
different sorting techniques achieve the same final result but they can vary hugely
in their consumption of memory, CPU time and other system resources.
• Titled Programming Exercises. All the programming exercises are titled to help
instructors tune assignments for their classes.
• Debugger Appendices. We’ve updated the Visual C++® and GNU gdb debugging
appendices.
• Order of Evaluation. We added cautions about order of evaluation issues.
• Additional Exercises. We added more function pointer exercises. We also added
a Fibonacci exercise project that improves the Fibonacci recursion example (tail
recursion).
• C++-Style // Comments. We use the newer, more concise C++-style // com-
ments in preference to C’s older style /*...*/ comments.
• C Standard Library. Section 1.7 references P.J. Plauger’s Dinkumware website
(www.dinkumware.com/manuals/default.aspx) where students can find thor-
ough searchable documentation for the C Standard Library functions.
A Note About Secure C Programming xxi

A Note About Secure C Programming


Throughout this book, we focus on C programming fundamentals. When we write each
How to Program book, we search the corresponding language’s standards document for the
features that we feel novices need to learn in a first programming course, and features that
existing programmers need to know to begin working in that language. We must also cover
programming fundamentals and computer-science fundamentals for novice program-
mers—our core audience.
Industrial-strength coding techniques in any programming language are beyond the
scope of an introductory textbook. For that reason, our Secure C Programming sections
present some key issues and techniques, and provide links and references so you can con-
tinue learning.
Experience has shown that it’s difficult to build industrial-strength systems that stand
up to attacks from viruses, worms, etc. Today, via the Internet, such attacks can be instan-
taneous and global in scope. Software vulnerabilities often come from simple program-
ming issues. Building security into software from the start of the development cycle can
greatly reduce costs and vulnerabilities.
The CERT® Coordination Center (www.cert.org) was created to analyze and
respond promptly to attacks. CERT—the Computer Emergency Response Team—pub-
lishes and promotes secure coding standards to help C programmers and others implement
industrial-strength systems that avoid the programming practices that open systems to
attacks. The CERT standards evolve as new security issues arise.
We’ve upgraded our code (as appropriate for an introductory book) to conform to var-
ious CERT recommendations. If you’ll be building C systems in industry, consider reading
The CERT C Secure Coding Standard (Robert Seacord, Addison-Wesley Professional, 2009)
and Secure Coding in C and C++ (Robert Seacord, Addison-Wesley Professional, 2006). The
CERT guidelines are available free online at www.securecoding.cert.org. Mr. Seacord, a
technical reviewer for the C portion of this book, provided specific recommendations on
each of our new Secure C Programming sections. Mr. Seacord is the Secure Coding Manager
at CERT at Carnegie Mellon University’s Software Engineering Institute (SEI) and an
adjunct professor in the Carnegie Mellon University School of Computer Science.
The Secure C Programming sections at the ends of Chapters 2–13 discuss many impor-
tant topics, including testing for arithmetic overflows, using unsigned integer types, new
more secure functions in the C standard’s Annex K, the importance of checking the status
information returned by standard-library functions, range checking, secure random-number
generation, array bounds checking, techniques for preventing buffer overflows, input valida-
tion, avoiding undefined behaviors, choosing functions that return status information vs.
using similar functions that do not, ensuring that pointers are always NULL or contain valid
addresses, using C functions vs. using preprocessor macros, and more.

Web-Based Materials
This book is supported by substantial online materials. The book’s Companion Website
(www.pearsonhighered.com/deitel) contains source code for all the code examples and
the following appendices in searchable PDF format:
• Appendix E, Sorting: A Deeper Look
• Appendix F, Introduction to the New C Standard
xxii Preface

• Appendix G, Using the Visual Studio Debugger


• Appendix H, Using the GNU Debugger

Dependency Charts
Figures 1 and 2 show the dependencies among the chapters to help instructors plan their
syllabi. C How to Program, 7/e is appropriate for CS1 and CS2 courses, and intermediate-
level C and C++ programming courses. The C++ part of the book assumes that you’ve
studied the C part.

C Chapter Introduction
Dependency 1 Introduction to Computers,
the Internet and the Web
Chart
[Note: Arrows pointing into a
chapter indicate that chapter’s Intro to Programming
dependencies.] 2 Intro to C Programming

Control Statements,
Functions and Arrays
3 Structured Program
Development in C

4 C Program Control

5 C Functions

6 C Arrays

Streams and Files Pointers and Strings


9 C Formatted Input/Output 7 C Pointers

11 C File Processing 8 C Characters and Strings

Aggregate Types
10 C Structures, Unions, Bit
Manipulations and Enumerations
Data Structures
Other Topics and the New C Standard 5.14–5.16 Recursion

12 C Data Structures

13 C Preprocessor 14 Other C Topics F Intro to the New C Standard E Sorting: A Deeper Look

Fig. 1 | C chapter dependency chart.


Teaching Approach xxiii

C++ Chapter Object-Based


Dependency Programming
Chart 15 C++ as a Better C;
Intro to Object Technology
[Note: Arrows pointing into a
chapter indicate that chapter’s 16 Intro to Classes and Objects
dependencies.]
17 Classes: A Deeper
Look, Part 1

18 Classes: A Deeper
Look, Part 2

19 Operator Overloading

Object-Oriented
Programming
20 OOP: Inheritance

21 OOP: 22 Templates 23 Stream 24 Exception


Polymorphism Input/Output Handling

Fig. 2 | C++ chapter dependency chart.

Teaching Approach
C How to Program, 7/e, contains a rich collection of examples. We focus on good software
engineering and stressing program clarity.
Syntax Shading. For readability, we syntax shade the code, similar to the way most IDEs
and code editors syntax color code. Our syntax-shading conventions are:
comments appear like this
keywords appear like this
constants and literal values appear like this
all other code appears in black

Code Highlighting. We place gray rectangles around the key code.


Using Fonts for Emphasis. We place the key terms and the index’s page reference for each
defining occurrence in bold blue text for easy reference. We emphasize on-screen compo-
nents in the bold Helvetica font (e.g., the File menu) and C program text in the Lucida
font (for example, int x = 5;).
Objectives. The opening quotes are followed by a list of chapter objectives.
Illustrations/Figures. Abundant charts, tables, line drawings, UML diagrams, programs
and program output are included.
Programming Tips. We include programming tips to help you focus on important aspects
of program development. These tips and practices represent the best we’ve gleaned from a
combined seven decades of programming and teaching experience.
xxiv Preface

Good Programming Practices


The Good Programming Practices call attention to techniques that will help you pro-
duce programs that are clearer, more understandable and more maintainable.

Common Programming Errors


Pointing out these Common Programming Errors reduces the likelihood that you’ll
make them.

Error-Prevention Tips
These tips contain suggestions for exposing and removing bugs from your programs; many
describe aspects of C that prevent bugs from getting into programs in the first place.

Performance Tips
These tips highlight opportunities for making your programs run faster or minimizing the
amount of memory that they occupy.

Portability Tips
The Portability Tips help you write code that will run on a variety of platforms.

Software Engineering Observations


The Software Engineering Observations highlight architectural and design issues that
affect the construction of software systems, especially large-scale systems.

Summary Bullets. We present a section-by-section, bullet-list summary of the chapter.


Terminology. We include an alphabetized list of the important terms defined in each chap-
ter with the page number of each term’s defining occurrence for easy reference.
Self-Review Exercises and Answers. Extensive self-review exercises and answers are includ-
ed for self-study.
Exercises. Each chapter concludes with a substantial set of exercises including:
• simple recall of important terminology and concepts
• identifying the errors in code samples
• writing individual program statements
• writing small portions of C functions and C++ member functions and classes
• writing complete programs
• implementing major projects
Index. We’ve included an extensive index, which is especially useful when you use the
book as a reference. Defining occurrences of key terms are highlighted with a bold blue
page number.

Software Used in C How to Program, 7/e


We wrote C How to Program, 7/e using Microsoft’s free Visual C++ Express Edition (which
can compile both C and C++ programs and can be downloaded from www.microsoft.com/
Another Random Document on
Scribd Without Any Related Topics
Yngland.’ The prior took him at his own valuation and promised to
pay him £20 for lessons in the art, and gave him 20 nobles in
advance. Master Peter then gave his pupil some silver and
quicksilver with instructions how to treat them. These metals Prior
Ellis sealed hermetically in a glass vessel, which he then placed in an
earthen pot full of water, and this he kept hot for some ten weeks or
more, employing a young novice of the priory, Edmund Freke, a boy
of twelve, to keep up a continual fire. Master Peter came from time
to time to see how matters were progressing, and no doubt reported
favourably, but after a while the prior ‘perceyved yt was but a falce
crafte,’ broke the glass vessel, sold the silver for what it would fetch
and refused to pay his instructor the remaining 20 marks. Peter,
however, who was better skilled in making money out of men than
gold out of silver, threatened an action for debt, and as it chanced
that an offer of 20 marks was made at this time to the prior for the
lease of a rectory he handed the money over to Master Peter. ‘And
thus I never medelyd with hym syne, nor with the crafte nor never
wyll, God wyllyng.’
‘A young novice of the priory.’

WHITE MAGIC
Before the days of Sherlock Holmes and the scientific pursuit of
clues the ways of tracing lost or stolen property were devious and
varied. In recent times the aid of St. Anthony of Padua has often
been invoked. Why that good Saint should have taken up this branch
of detective work I know not; possibly he was confused with his
namesake the hermit, whose pig might well have been trained to
search for lost articles as less holy pigs to hunt for truffles, or
possibly, as was said of the man who married five wives, ‘it was his
hobby.’ However this may be, I have known excellent results
obtained by the promise of a candle or the repetition of a
paternoster in honour of St. Anthony; the prayer is the more popular
offering, being cheaper for the petitioner and more certain for the
saint—the candle is apt to be withheld when the property has been
recovered, and candles have even been known to go astray and
blaze before the altar of the other St. Anthony, who was probably
too busy in pre-Reformation days looking after the cattle of his
devotees to trouble about lost property. The man, therefore, who
would have supernatural assistance in the recovery of his strayed
goods had perforce to seek the aid of sorcerers and their familiar but
often incompetent spirits. Unfortunately for the modern inquirer no
unsolicited testimonials bearing witness to the efficacy of these
magicians appear to have survived, and it is only their failures that
brought them into unpleasant and enduring prominence.
London was naturally a great centre of these occult detectives, and
they seem to have been well patronised. In 1390 when two silver
dishes were stolen from the Duke of York’s house, application was
made to one John Berkyng, a renegade Jew, who performed certain
incantations, and as a result accused one of the Duke’s servants,
William Shadewater. In the same way, when Lady Despenser’s fur-
lined scarlet mantle was stolen, about the same time, Berkyng had
no hesitation in denouncing Robert Trysdene and John Geyte. His
repute was no doubt considerable, but these two cases proved
disastrous; the parties accused had him arrested, and he was found
guilty of deceit and defamation, stood in the pillory for an hour, and
was then banished from the city.
In this case nothing is said as to the means of divination employed,
but in two cases that occurred in London in 1382 particulars are
given. When Simon Gardiner lost his mazer bowl he employed a
German, Henry Pot by name, to trace it. He made thirty-two balls of
white clay, and after appropriate incantations named Nicholas
Freman and Cristine, his wife, as the thieves. Here again the mistake
brought the magician to the pillory, and the same fate befell Robert
Berewold. In this case also it was a mazer that had been stolen;
Maud of Eye was its owner, but a friend of hers, one Alan, a water
carrier, who had evidently a high opinion of Robert’s power, called
him in. Robert then took a loaf and fixed in the top of it a round peg
of wood and four knives at the four sides of the same, in the shape
of a cross; his further proceedings are vaguely described as ‘art
magic,’ and resulted first in the accusation of Joan Wolsey and
eventually in the appearance of Robert Berewold in the pillory with
the loaf hanging round his neck.
The connection between mazers and magic is not obvious, but in
1501 when John Richardson, a parish clerk, lost a mazer worth 26s.
he at once sought the assistance of Nicholas Hanwode, ‘bringing
with him divers young children for to behold in a looking-glass.’ The
record is damaged, but is sufficiently legible to show that the victim
was arrested and imprisoned by the mayor and could only invoke the
intervention of the Court of Chancery against his accusers. In this
last case we have clearly an instance of divination by the glass,
crystal, or similar medium—a pool of ink was used, if I remember
right, by the Indians in The Moonstone. The loaf and knives seem
vaguely familiar to me as instruments of divination, though I should
be puzzled to give the correct ceremonial, but the thirty-two clay
balls are more difficult to place, unless possibly they were used for
the construction of some kind of geomantic figure.
Robert Berewold in the pillory.

So far we have been dealing with genuine, if inaccurate, magicians,


but a case that occurred in London in 1382 shows that there were
impostors even in that learned profession. Mistress Alice Trig having
lost her Paris kerchief suspected Alice Byntham of having stolen it,
and apparently not without good reason. The two women seem to
have been fairly intimate, and Alice Byntham went to a cobbler,
William Northamptone, and gave him information of certain very
private matters concerning the other Alice. William then went round
to Mistress Trig and posed as a wise man, which he may have been,
skilled in magic, which he was not, and revealed to her his
knowledge of her private affairs. She, being duly impressed, asked
him who had stolen her kerchief, to which he replied, whoever it was
it certainly was not Alice Byntham, and launching out rashly into
prophecy told his questioner that she would be drowned within a
month. The dismal prospect almost terrified her into an early grave,
but in the end she survived to see William standing in the pillory.
A case that is recorded in Lincolnshire in the sixteenth century is
interesting as showing the more than local reputation enjoyed by
some of these cunning men. The church of Holbeach having been
robbed, the parishioners consulted their fellow-townsman John
Lamkyn, a man known to have ‘resonable knowledg in the sciens of
gramer,’ which he taught to the children of the neighbourhood, and
said to have a knowledge not so reasonable of such arts as
enchantment, witchcraft, and sorcery. He, at the request of the
churchwardens, went off to consult Edmund Nash, a wheeler, famed
as ‘an expert man in the knowleg of thynges stolen,’ who lived at
‘Cicestre,’ which may have been either Chichester or Cirencester, as
it is called in one place ‘Chechestre’ and in another ‘Circetter,’ but
was in any case a very long way off. Lamkyn took with him a pair of
leather gloves found in the vestry after the robbery, and Nash made
certain deductions therefrom, which caused suspicion to fall upon
John Partridge, who complained that he had lost friends and
reputation and been ‘brought into infamy and slander and owte of
credenz.’ Lamkyn’s version of the story made out Nash to be merely
a private detective following up clues without recourse to magic, and
also hinted that Partridge’s reputation was no great loss. There is as
little reason to believe one as the other.
Probably the most popular method of ascertaining the whereabouts
of lost property and the identity of the thief was by the use of
astrology. Some years ago, when I was in one of those bookshops in
which at that time I spent much of my spare time and all of my
spare money, I was offered a manuscript volume, formerly the
property of William Lilly, in which that famous but shifty astrologer
had recorded some scores of investigations made by him for clients
and mostly concerned with the recovery of stolen goods. The figures
were neatly drawn up, and the interpretation written below, but, if
my memory serves me, there was nothing to show in how many
cases the investigations led to any practical result. There are, I
believe, two similar volumes in the Bodleian, but what became of
this particular copy I do not know; whether it was due to the unfair
incidence of taxation under the budget of that year or to more
permanent causes, my funds did not permit of its acquisition, and I
left it sorrowfully in company with a much-desired Augsburg Missal
and Pine’s edition of Horace—the rare edition of the ‘post est’
blunder. I did, however, secure Fludd’s Macrocosm, by aid of which I
might myself, if time and my mastery of the movements of the
whirling spheres permitted, open a branch of the heavenly Scotland
Yard.

‘... sware “gret othes” and took himself by the hair.’


The early astrologers, thanks to the cautious vagueness of their
statements, seem to have avoided the clutches of the law, into
which other magicians fell. The stars reveal no names, recording
only, by an anticipation of the Bertillon procedure, the
measurements and physical peculiarities of the thieves. If from these
particulars the querent jumps to a false conclusion and accuses the
wrong man, so much the worse for him—the stars and their
interpreters are not to blame. No one said hard words of the London
astrologers whom Robert Cooke consulted. Cooke was a carrier from
Kendale who came south in 1528 with £30 in money, much of it
belonging to other men, in a ‘bogett,’ and put up at John Balenger’s
house in St. Ives. During the course of the day he opened his packs,
bought and sold and drank with his customers, allowing a number of
people in quite a casual way to feel the weight of his ‘bogett,’ but
not opening it. It was late that night before they got to bed at John
Balenger’s, for ‘it was ten of the clok or they went to soper, for as
much as every man pakked up his wares or they sooped,’ and when
they went up to their rooms the house was apparently pretty full, as
Cooke shared a bed with John Foster, a draper, and there were
others in the same chamber. Next morning, as they were putting
their packs on their horses, Cooke suddenly noticed that one of his
packs was fastened with a different kind of knot from that which he
used. Thereupon he suddenly exclaimed, ‘My pak is wrong knyt, by
the passhion of God, sith yesternight,’ and opening it took out the
precious ‘bogett’ and found it full of stones. So he sware ‘gret othes’
and took himself by the hair and altogether carried on mightily, and
finally ‘made his advow that he would never ete fisshe ne fleissh
until he had been at Saint Rynyons in Scotland if he might here of
his goodes.’ Then, with his bed-companion of the previous night, he
rode over to Cambridge ‘to make calculacion for the said goodes,’
but at that seat of learning ‘they coude find noo clerk or other
person that wold take on hand to calcle for the said money.’
However, when Robert Cooke got to London he had no difficulty in
finding astrologers, who expressed the utmost confidence in their
ability to ‘calcle,’ and told him that ‘he shulde by the crafte of
astronomye, if he wold, have hys eye or arme or other joynte of hys
body thatt hadd robbed hym, att hys pleasure.’ This ferocious
promise, it may be pointed out, merely meant that the astronomer
could give a description of any particular physical traits necessary to
indentify the robber. In this particular instance the description was
that of a fair man with large eyes, hair neither curly nor straight, and
a large nose, of medium height, good looking, with a bright
expression, and having one or more black teeth. This elaborate
account the astronomer, with becoming modesty, had submitted to
the judgment of others more learned and experienced than himself,
and they guaranteed its accuracy. It was found to correspond with
the appearance of John Balenger the younger, son of Cooke’s host,
except that the latter ‘hath no blak toth in his hed as yt apperith iff
ony lust to serch therfor,’ and in order to prove this ‘the said John
Balenger was caused to sytte down and in large wyse to gape and
open his jowes to be duely seen ... and after due serch therin made
yt appeared that the said John had alle his teth whyte and in good
maner proporconed.’ Adding to this the fact that he was ‘callid a
good young man and wele ruled, not slaundered neither with dicyng,
carding ne other misrule,’ and the rather suspicious circumstance
that the biggest stone found in Cooke’s ‘bogett’ after the supposed
robbery was a piece of ironstone of a kind not found within forty
miles of St. Ives but very plentiful in Kendale, it is not surprising that
the magistrates should have dismissed the case against the younger
John Balenger. After all, a black tooth is like a finger-tip print—
damning evidence if present but powerful for acquittal if absent, and
who is a Justice of the Peace that he should contradict Jupiter?
‘... caused to sytte down and in large wyse to gape.’

BLACK MAGIC
Considering how large a part magic and the supernatural played in
the life of the people in the Middle Ages it is curious that there
should be so few references thereto in the English judicial records
prior to the Reformation. The ancient chroniclers and historians
enlivened many a dull page with the most astonishing tales of sin
and mystery, vouched for on the testimony of their own eyes or of
unimpeachable witnesses, but the chains of legal evidence are as
powerless to bind these legendary sorcerers as were the triple
chains of iron to bind the famous Witch of Berkeley. With the
exception of general vague accusations of witchcraft levelled against
the Lollards and kindred heretics, references to magic are casual and
rare in the records of our courts.
With the reign of Elizabeth this ceases to be true, and from the
middle of the sixteenth century to the end of the seventeenth the
Black Arts attracted their full share of judicial and magisterial
attention. Probably twenty instances of legal proceedings taken in
connection with these ‘ungodly practices’ could be produced after
the Reformation for every one prior to that date, and while this is in
part due to the fact that local records of the later periods have
survived in far greater number than their predecessors, there is a
possibility that post hoc is in the case also propter hoc. It is arguable
that the Reformation having abolished, for all practical purposes,
belief in the miracles of God and His saints, the natural craving of
the unscientific man for a supernatural explanation of the abnormal
could only be satisfied by a belief in the miracles of the Devil and his
sinners. Be that as it may, the fact remains that after the
Reformation witches and warlocks became as common as holy nuns
and anchorities had once been—the marvels reported of the one
class are about as unsatisfactory from a scientific point of view as
those of the other. It is, however, with a few chance references of
earlier date that I am concerned.
Suitably enough it is from the land of ‘Cunning Murrell’ that my
earliest instance comes. The Sheriff of Essex in 1169 made a note of
having expended 5s. 3d. on ‘a woman accused of sorcery.’ The
record is brief and unsatisfactory, telling neither the details of the
offence, the method of trial, nor the result. These two last items we
get in another case which occurred in Norfolk in 1208, when Agnes,
wife of Odo the merchant, appealed a certain Galiena for sorcery,
and Galiena successfully cleared herself by the ordeal of the hot
iron. For a century after this any magical offenders who may have
been brought to trial have eluded my search. Then in 1308 began
the proceedings against the Knights Templars, based very largely on
accusations of practising Black Magic. In England, however, nothing
of the kind was even held to have been proved against the knights,
although not only ‘what the sailor said’ was considered to be
evidence, but also what the clerk thought the priest said the soldier
heard the sailor say.
‘... thrust a leaden bodkin into
the head of that image.’

It is rather remarkable that the year 1324, in which the great Irish
trial of the Lady Alice Kyteler took place, was the date of the fullest
and in many ways the most interesting of the early English trials for
sorcery. In that year Robert Marshall of Leicester, under arrest for a
variety of offences, endeavoured to save his own neck by turning
King’s evidence and accusing his former master, John Notingham,
and a number of Coventry citizens of conspiring to kill the King, the
two Despensers, and the Prior and two other officials of Coventry by
magical arts. Marshall’s tale was to the effect that the accused
citizens came to John Notingham, as a man skilled in ‘nigromancy,’
and bargained with him for the death of the persons named, paying
a certain sum down and giving him seven pounds of wax. With the
wax Notingham and Marshall made six images of the proposed
victims and a seventh of Richard de Sowe, the corpus vile selected
for experimental purposes. The work was done in secret in an old
deserted house not far from Coventry, and when the images were
ready the magician bade his assistant thrust a leaden bodkin into the
head of that image which represented Richard de Sowe, and next
day sent him to the house of the said Richard, whom he found
raving mad. Master John then removed the bodkin from the head of
the image and thrust it into the heart, and within three days Richard
died. And at that point Robert Marshall’s story comes to a lame and
impotent conclusion. Not a word of explanation does he give as to
why, when the preliminary experiment had proved so successful,
they did not go on with their fell design. The unfortunate
‘nigromancer’ died in prison before the case had been thrashed out
and reported upon by a jury, and the case against the citizens was
allowed to fall through. Even if the trial had followed its normal
course it is not probable that we should have had more than a plain
and enlightening verdict of ‘not guilty,’ for Robert Marshall was a liar
of inventive genius. He accused two men of assisting him in the
robbery and murder of a merchant from Chester ‘in Erlestrete,
Coventry, near the white cellar,’ with a profusion of ‘corroborative
detail, intended to give artistic verisimilitude to an otherwise bald
and unconvincing narrative,’ which proved, as he afterwards
admitted, utterly false. One or two other wild accusations also came
to nothing, and Robert was duly hanged. But while we cannot say
that the procedure he described was actually used in this case, we
know it was quite in accord with the orthodox methods of magicians.
That the story was believed at the time we may conclude, as the
younger Despenser wrote this year to the Pope complaining that he
was threatened by magical and secret dealings. The Pope, with
much good sense, recommended him to turn to God with his whole
heart and to make a good confession and such satisfaction as should
be enjoined upon him; adding that no other remedies were needful.
Passing again over a century we find in 1426 William, Lord Botreaux,
complaining that Sir Ralph Botreaux, William Langkelly, and others,
‘unmindful of the salvation of their souls and not having God before
their eyes,’ had procured John Alwode of Trottokeshull, Hugh Bower
of Kilmington, chaplain, and John Newport, who were said to
practise soothsaying, necromancy, and art magic, ‘to weaken, subtly
consume, and destroy by the said arts,’ the complainant’s body.
Commissioners were appointed to inquire into the matter, but any
further proceedings that there may have been have vanished, or at
best are lying hid in some unsuspected corner of the Record Office.
Another instance of the use of magical ceremonies with evil intent is
alluded to fifty years later, when John Knight, chaplain, complained
that he had been arrested and committed to the Marshalsea for
going with the servants of ‘the Lord Straunge’ to search the house of
Alice, wife of John Huntley, ‘which of long tyme hath used and
exercised the feetes of wychecraft and sorcery,’ in Southwark. They
went into ‘an house called the lasour loke in Suthwerk in Kenstrete’
(a hospital founded originally for lepers, but by this time used more
as an almshouse or infirmary) ‘and there found dyvers mamettes for
wychecraft and enchauntements with other stuff beryed and deeply
hydd under the erthe.’ The circumstances are very similar to those
related in the case of an old woman turned out of the almshouses at
Rye in 1560 for using magical ceremonies, including the burial of
pieces of raw beef, to the intent that as the beef decayed away so
might the bodies of her enemies, though it is possible that in the
case of Alice Huntley the objects had only been buried for secrecy.
Five-and-twenty years later, in 1502, a still clearer case of the use of
‘mamettes’ or images occurred in Wales. The bishop of St. Davids,
having vainly remonstrated with Thomas Wyriott and Tanglost
William for living ‘in advoutre,’ imprisoned the woman Tanglost and
afterwards banished her from the diocese. She went to Bristol, and
hired one Margaret Hackett, ‘which was practized in wychecraft,’ to
destroy the bishop. Tanglost and Margaret then went back to
Wyriott’s house, and in a room called, most unsuitably, Paradise
Chamber, made two images of wax, and then, possibly thinking that
a bishop would take more bewitchment than an ordinary mortal,
sent for another woman, ‘which they thought cowde and hadde
more cunning and experiens than they,’ and she made a third image.
The bishop was not a penny the worse for this ‘inordinat delying,’
but ordered the arrest of Tanglost for heresy; Wyriott intervened by
getting her imprisoned through a trumped-up action for debt, in
order to keep her out of the bishop’s clutches, and the bishop had to
invoke the assistance of the Court of Chancery.
Three cases of magic occurred in 1432. On May 7 of that year an
order was issued for the arrest of Thomas Northfelde, D.D., a
Dominican friar of Worcester, and the seizure of all his books treating
of sorcery or wickedness, and two days later Brother John Ashwell of
the Crutched Friars, London, John Virley, priest, and Margery
Jourdemain, who had been imprisoned at Windsor for sorcery, were
released. In these cases it is very likely that the sorcery consisted in
an uncanny and suspicious addiction to unusual branches of
learning, combined possibly with experiments in chemistry or
heretical tendencies, both alike dangerous in the eyes of the
orthodox, but the third case was clearly a matter of bewitchment—in
the opinion of the victim. The facts are quite simple. John Duram of
York had a field with a pond in it, and having in some way incurred
the enmity of Thomas Mell, a farmer, the latter, ‘per divers artes
erroneous et countre la foy catholice cest assavoir sorcery,’ withdrew
the water from John’s pond, to the great injury of his cattle, besides
certain other unnamed injuries wrought by his ‘malveys ymaginacion
et sotell labour.’ Mell being under the patronage of men of influence
because of his magical abilities, Duran did not dare to bring an
action against him in the ordinary court, and therefore sought the
intervention of the Court of Chancery, with what success I do not
know.
So far my magicians, it must be admitted, have been rather
commonplace people, proceeding on the usual lines of their craft
and displaying little originality, but my final instance is, so far as I
know, unique. In an eighteenth-century manuscript in my
possession, formerly in the Phillipps collection, amongst a mass of
extracts from all kinds of records is an entry said to be taken from
the court rolls of the manor of Hatfield in Yorkshire. According to
this, at a court held in 1336 Robert of Rotheram brought an action
against John de Ithen for breach of contract, alleging that on a
certain day, at Thorne, John agreed to sell him for threepence-
halfpenny ‘the Devil bound with a certain bond’ (Diabolum ligatum in
quodam ligamine), and Robert thereupon gave him ‘arles-penny,’ or
earnest-money (quoddam obolum earles), ‘by which possession of
the said Devil remained with the said Robert, to receive delivery of
the said Devil within four days,’ but when he came to John the latter
refused to hand over the Devil, wherefore Robert claimed 60s.
damages. John appeared in court and did not deny the contract, but
the steward, holding that ‘such a plea does not lie between
Christians,’ ‘adjourned the parties to Hell for the hearing of the case,’
and amerced both parties.
The first question is, is this a genuine extract from the rolls? The
critic who is inclined to think that he smells a rat may be confuted by
Camden, according to whom no rats have ever been known in the
town of Hatfield. The extremely solid nature of all the other extracts
in my volume is almost a guarantee of good faith so far as the
eighteenth century copyist is concerned, and the probability that he
took it from the original is strengthened by his having in one place
misread unde as vide and subsequently corrected the error. But
allowing that it occurred on the rolls, was it a genuine transaction or
was it a facetious invention of the manor clerk? I incline to believe
that it was genuine. A man who invented such a case to fill up a
blank space on the roll would have been almost certain to have
elaborated it further, while, on the other hand, having noted the
adjournment of the case to ‘another place,’ to use parliamentary
language, he would not have been likely to add that both parties
were fined. Granting that the action was actually brought, we are
left in doubt whether Robert was a simple gull with whom John had
been amusing himself, or whether the defendant really believed that
he could fulfil his contract. Again, what was that contract? Latin,
though admirably clear in many respects, suffers from the absence
of the definite article, and it is difficult to be certain whether it was a
question of ‘the Devil’ or ‘a devil’; judging by the price, the latter
seems more probable, as threepence-halfpenny for the Prince of
Darkness seems absurdly little, and I believe that Diabolus ligatus
was sometimes applied to a divining spirit imprisoned by magic arts
in a bottle or crystal. However that may be, it is not probable that a
law court has ever before or since been asked to decide the question
of proprietary rights in the devil or his imps.
‘Diabolus ligatus.’
II
HIGHWAYS

S O much is heard of the modern facilities for travelling that one


might almost think that before the days of Cook (Thomas of the
tickets, not the Polar Mandeville) no Englishman had ever stirred
abroad. Yet it is hardly questionable that in mediæval times the
proportion of Englishmen who had visited foreign lands was far
larger than at the present day. Thanks to military feudalism it is
scarcely an exaggeration to say that during the fourteenth and
fifteenth centuries most of our country gentlemen had seen service
in France, taking with them contingents of hired or pressed men
from every village in the land. For the more peaceful classes there
were the attractions of the pilgrimage, the spiritual advantages
outweighing the dangers and hardships of a journey to Rome, and
the celebrated shrine of St. James of Compostella drawing
thousands every year to Spain. Still earlier the Crusades drew the
pious and the martial alike yet farther afield, but of those who
journeyed to the East many did not return. At all time a pretty sharp
limit was set to the travels of the ordinary man by the seaboard of
Palestine, and those who penetrated still deeper into the mysterious
East were few. It is therefore interesting to follow Geoffrey of
Langley on his embassy to the Tartar Court in 1292 and back to
England, piecing together the story of his travels from the prosaic
accounts of his paymaster.
Towards the end of the twelfth century the Tartars, a nomadic tribe
who inhabited the district between the Caucasus and the Euphrates
and professed the Christianity of the Nestorians, came into some
prominence in Europe through the fame of their Khan, the
celebrated ‘Prester John.’ He, however, was killed in 1203 by the
terrible Genghiz Khan the Mogul, from Turkestan, whose successors
adopted the name and, after one or two generations, the religion of
the conquered Tartars. Argon, King or Emperor of the Tartars,
accepted Christianity in 1289, and in alliance with the kings of
Armenia and Georgia inflicted a severe defeat upon the forces of the
Soldan. Later in the same year his ambassadors reached Europe,
charged to preach a new crusade for the ejection of the Saracens
from Palestine. Strengthened with commendatory letters from the
Pope, they visited the English Court. King Edward made them
welcome, and wrote to Argon expressing his delight at his proposed
attack upon the Sultan of Babylon, and promising to come in person
as soon as the Pope would sanction his going to the Holy Land. To
cement the alliance he promised to send the king some gerfalcons,
for which he had asked. This letter was written in September 1290,
and next year the falcons were duly dispatched by the hands of Sir
Geoffrey of Langley.
The embassy reached Trebizond about the middle of June 1292, and
obtained quarters for themselves and the precious gerfalcons while
waiting for a safe-conduct to the Tartar Court. The king’s
whereabouts were uncertain, and Nicholas de Chartres, Geoffrey’s
squire, and Conrad, nephew of the ambassador’s chief-of-staff,
Buskerell, were sent by sea to Samsoun, and thence first to
Kaisarieh and then to Sivas, where they waited for the king. At last
all was ready; a tent had been made from cotton cloth and scarlet
and grey material, bought in Trebizond, a parasol had been
purchased for the ambassador, and a horse for him to ride, and also
a mule, which cost more than three times as much as the horse. For
the first stage of the journey to Tabriz, where they were to see the
king, thirty horses were hired, but at Baiburt, which they reached on
July 25, the number was reduced, and from Baiburt to Zaratkana
only fourteen horses were employed. Beyond the giving of presents
to Tartars and others, including a gift of cloth to ‘the lady’ of Erz
Roum, little is recorded of the journey to Tabriz—the city of baths
and iced drinks, as the Spanish ambassadors to Timour Bey found it
a century later.
The embassy left Tabriz, carrying with them a leopard as a present
from the Tartar king, and on Friday, September 26, reached the busy
trading town of Khoi, where Gonzalez de Clavijo on his way to
Samarcand in 1406 saw a giraffe, which he deemed, ‘to a man who
had never seen such an animal before, a wonderful sight.’ Sunday
night they spent at ‘Nosseya,’ presumably Nuskar, and Monday at a
village ‘of the Armenians,’ evidently near the Lake of Van, as fish
appear for the first time amongst the provisions bought, in addition
to the usual bread, cheese, and fruit. At Argish on the Lake of Van
boots were bought for three members of the suite, the horses were
shod and stores laid in, including wine, meat, ducks, eggs, and salt.
After stopping one night at ‘Jaccaon,’ Melasgird was reached, where
they dismissed their mounted escort from Argish and proceeded
under fresh escort through three nameless Saracen villages to Erz
Roum, which they reached on Monday, October 6. A two days’ halt
was made here while they laid in stores and had their clothes
washed. The wear and tear of travelling began to be felt; boots had
to be bought for the chaplain, John the clerk, Robert, Gerard,
another Robert, and William and Martin the grooms, and a hat and
shoes for Willecok. On the Wednesday night, when they stayed at
another Saracen village, they were entertained by native minstrels,
and the following day they reached Baiburt, where John the
scullion’s boots gave out. Here they had to lay in stores, as the next
two halts were to be ‘in the fields,’ away from habitations.
‘A wonderful sight.’

At last, on Monday, October 13, they found themselves back at


Trebizond, where they rested for a week and invested largely in new
shoes, as well as in such heavy and bulky conveniences as pots and
pans, plates, dishes, and stools, with which they had had to
dispense on their journey. The Saracen porters who had carried the
baggage from Tabriz were paid off, a Tartar who had rendered some
small service was rewarded with a carpet, and the ambassador’s
suite received their wages and allowances of linen. At the head of
the suite was Andrew Balaban, who received a scarlet robe in
addition to his wages, and Martin the latimer, or interpreter; then
there were Willecok the chamberer, John the clerk, Walter the cook,
Martin Lombard the larderer, and Michael and Jonot ‘of the kitchen’;
Chyzerin, Copin, and Tassin the falconers, Jacques and Oliver the
grooms, Michael de Suria, Theodoric, Manfred, Gerardin, Robert, and
Robekin, and one or two others of whom we learn nothing but their
names. Altogether there must have been about twenty or thirty
persons who sailed from Trebizond and after a slow voyage reached
Constantinople on Sunday, November 9.
At Constantinople, which the accountant by an ingenious error of
derivation calls ‘Constantinus Nobilis,’ the galley lay for a week,
possibly delayed by adverse winds. There were compensations for
the delay; oysters, hares, mallards, chestnuts, pears, and apples
must have been welcome luxuries after the hardships and monotony
of the past weeks, and it is possibly more than a coincidence that
the doctor had to be called in to attend Richard. Even the leopard
fared daintily, three chickens making a pleasant change from his
usual mutton. At last everything was ready, the clothes had been
washed, John the clerk’s hose had been mended, some Persian cloth
had been bought for Richard’s tabard, and the parasol had been re-
covered, which seems hardly necessary, unless it was to be used as
an umbrella; the weather being cold, eighteen sets of wraps
(muffeles) were bought for the suite, while Sir Geoffrey procured
fur-lined robes of vair, gules, and white fox with a hood of
‘Alcornyne,’ and on Monday, November 17, the galley set sail for
Italy.
Otranto was reached on Saturday, November 29, and here the
ambassador and part of his suite landed, Richard and Robert going
on at once to Brindisi by boat. The galley waited long enough to
revictual and to allow of cleaning the leopard’s cage, and then went
on with the rest of the suite and the heavier luggage to Genoa. On
Sunday, the Bishop of Otranto having kindly lent them horses, the
ambassador’s party started on their journey overland to Genoa,
reaching Lecce in time for dinner and an impromptu entertainment
by three minstrels. The first four days of December were spent at
Brindisi, whence they went on up the east coast by Villanuova and
Mola to Barletta, then turning inland to ‘Tres Sanctos,’ which may
have been Trinitapoli, but was chiefly noteworthy for a dinner of
chicken, pigeons, and sausages. Next morning, Wednesday,
December 10, they lunched at San Lorenzo on their way to Troja,
and so, past ‘Crevaco’ to ‘Bonum Albergum,’ which, if it was not
Benevento, was not far from that town. Two days more brought
them, by Monte Sarchio and Acerra, to Naples, where they remained
until Thursday, the 18th. Here they were once more in a land of
plenty and could feast on pheasants, partridges, mallards, hares,
and pigeons, skilfully seasoned with sage and parsley, garlic, and
saffron. Two mules and a dappled grey horse were bought, as well
as some glasses and earthenware pots and mugs, and the party set
out for Capua, sending their silver plate on ahead by the hands of
Manfred Oldebrand. At Capua, on Friday, December 19, Tassin the
falconer died, much regretted by his brother falconer, Hanekin, to
whom he owed 11s. 4d., and offerings were made for the good of
his soul.

‘An impromptu entertainment by three minstrels.’

Five days’ march, through Mignano, Ceprano, Anagni, and a place


called ‘Mulera,’ which I cannot identify, brought them to Rome. At
Rome they spent Christmas. A doctor was called in to attend one of
the grooms, and medicine was obtained for a horse, possibly without
avail, as two horses were bought for thirty florins, from ‘the
merchants of the Ricardi.’ On Sunday, the 28th, the journey was
resumed, Isola and Sutri forming the first day’s march, Viterbo and
Monte Fiascone the second. Acquapendente was reached on
Tuesday, and here they spent 18d. on ‘a small box (cofinello) in
which to carry eel pies.’ Passing San Quirico, Siena was reached on
the 1st of January, their road after that leading through San
Cossiano, Pistoia, and Buggione, to Lucca. From Lucca they struck
across to the coast, through Avenza and Sarzana to Sestri, and so up
by Rapallo and Recco to Genoa, which they reached on Sunday,
January 11. At Genoa they found their companions, who had come
round by sea. A house was hired from Pucino Roncini, the galley was
unloaded and paid off, its cost from Trebizond to Genoa being £200,
a sum more formidable in appearance than in reality, as the Genoese
pound was only about 3s. 6d. of English money. Tamorace the Tartar
was dismissed with the present of a silver cup, and there remained
only the leopard to link them with the East.
At Genoa the series of accounts terminates, but the dispatch of a
messenger to the Marquess of Saluzzo suggests that our travellers
were going through his territory, by the same road that Henry of
Bolingbroke, Earl of Derby and afterwards King of England, followed
just a century later on his return from Venice and the East, taking
with him, by a coincidence, a leopard. In that case they would have
gone inland, past Novi, Asti, and Turin to Chambéry in Savoy, then
northwards to Châlons, and by Beaune, Châtillon, and Nogent-sur-
Saône to Paris. Thence they would probably have made for Wissant,
and so across to Dover, reaching England about the beginning of
September, 1293, or rather earlier, after two years of almost
continual travelling. Of the wonderful things that they saw, and the
yet more wonderful things that they heard—tales of monstrous men,
uncanny beasts, and evil spirits—of their adventures, perils of
shipwreck, and perils of robbers, no record has survived; but
something of their slow journeying, the trying desert marches, the
vexatious delays of contrary winds, pleasantly varied by the
relaxation of a halt in some great city, we have managed to piece
together.
Such exceptional voyages as those of Geoffrey of Langley to Tabriz
or of Gonzalez de Clavijo to Samarcand are interesting for their
rarity; but a value of another kind attaches to the embassy of Hugh
de Vere to the Papal Court in 1298. It was a placid and uneventful
journey, and would seem to have been not merely without
adventures, but without incidents. Beyond the trifling worries
attendant on pack saddles and harness that required constant
repairs, the trifling interest derived from varying changes of diet, and
the complication of accounts caused by the existence of an entirely
fresh monetary standard in each state through which the travellers
passed, there was little to record but the list of stages on the
journey. As, however, the route followed was the main road to
Rome, along which passed a constant stream of pilgrims, prompted
by piety or a wish to see the world—priests seeking benefices for
themselves or curses for their neighbours; penitents desiring
absolution; appellants with their wallets stuffed with deeds, decrees,
and legal precedents, and their appellees carrying the weightier
argument of English gold—it is worth while following the embassy
and noting the stopping-places. Most of these are identical with
those used by Henry of Bolingbroke on his return from Venice almost
a century later, and were, therefore, evidently the usual stages on
this road.
Pilgrims.

Hugh de Vere and his suite, consisting of two knights, two chaplains,
a clerk, ten esquires, and some thirty grooms and other attendants,
assembled at Paris on Good Friday, April 4, 1298, and next day rode
as far as Rozoy, contenting themselves on the journey, as it was a
fast day, with fish and fruit. The next day being Easter Sunday they
did not start until after dinner, but reached Provins, fifty miles south-
east of Paris, in the evening. From Provins of the Roses the
cavalcade passed by Pavillon down the valley of the Seine to Bar-
sur-Seine, where, Lent being over, they feasted on meat and pies
and flauns, a kind of mediæval pancake particularly popular at
Easter-time, according to Haliwell. They soon entered Burgundy, and
turning south through Montbard followed for some distance the
route now taken by the Canal de Bourgogne with its innumerable
locks, and after halting a night at ‘Flori’—which occurs in
Bolingbroke’s account as ‘Floreyn,’ but would seem to have dwindled
out of the maps if not out of existence—reached Beaune; and still
doing an average of thirty miles a day came to Lyons, stopping at
Tournus and Bellville on the way, on Monday, April 14. After
following the valley of the Rhone a few miles farther south, they
turned off eastwards near Vienne through St. Georges to Voiron and
thence northwards, passing close to the Grande Chartreuse, across
the borders of Savoy to Chambéry. So far the currency in use had
been ‘neir Turneis,’ or black money of Tours, 14d. of ‘petit tournois’
being equivalent to one ‘gros tournois,’ the standard to which all
other denominations are reduced in these accounts, a coin worth
approximately 3d. sterling; but now and all the way through Savoy
and Piedmont payments are entered in ‘Vieneys,’ of which seventeen
went to the ‘gros tournois.’
Through the mountainous district of Savoy progress was markedly
slower, the sixty miles from Chambéry to Susa taking six days. The
road by which they travelled followed the valley of the Arc, as does
the modern railway, past Montmélian, la Chambre, and St. Michel;
but as the Mont Cenis tunnel had not then been completed the
ambassador and his suite had to go farther east to Lansle Bourg,
toiling up Mont Cenis to the hospice founded on that storm-swept
road by the pious King Louis, first of his name, and then dropping
down to Piedmont and the ancient town of Susa, where after the
hardships of the day’s journey they regaled themselves with ‘tartes
et flaunes.’ Whether it was the climbing or the flauns I do not know,
but next day Sir Hugh’s palfreman was ill, and another servant had
to be put in his place at Avigliano. On Friday, April 25, Turin was
reached, and a stay was made here until the following Tuesday, a
rest that must have been welcome after three weeks’ continuous
travelling. Portmanteaux and bags were repaired, clothes washed,
and bodies reinvigorated by a more varied choice of food than was
possible while travelling; shoulders of mutton, pigeons, chickens,
figs, grapes, and other fruit were bought, and the cook prepared
‘charlet,’ evidently an ancestress of the aristocratic Charlotte Russe
rather than of her plebeian namesake Apple Charlotte, as the
constituents were milk and eggs. The journey was resumed on
Wednesday, April 30, the route lying eastwards through Chivasso
and Moncalvo to an unidentifiable place, ‘Basseignanh,’ evidently just
across the Po in Lombardy, as here the coinage becomes ‘emperials,’
of which it required twenty to make a ‘gros tournois.’ Lomello, Pavia,
Piacenza, Borgo San Donnino (where for the first time we note a
purchase of cheese, for which the district is still famous), Parma,
Reggio, and Modena follow in uneventful succession, but instead of
continuing along the same line to Bologna, as does the modern
traveller, the embassy now turned sharply to the south-west to
Sassuolo. In this more countrified district the rate of exchange fell,
and the ‘gros tournois’ was only worth eighteen instead of twenty
‘emperials,’ but as a compensation the accountant notes under
Frassinoro, the next station on the road through the picturesque
valley of the Secchia, that the expenses of four days were small,
thanks to the presents of ‘la Marcoys.’ I am not clear as to the
identity of this Marquess; all this part of Italy was a mass of little
lordships and semi-independent principalities, but for the most part
their lords were Dukes. The Marquess of Carrara seems a reasonable
suggestion—if I am right in thinking that there was such a person,
and am not confusing him with the Marquess of Carabas, who, from
his occurrence in the history of Puss in Boots, was presumably a
noble of Catalonia. Lucca was reached on the eve of Ascension Day,
and the feast itself was spent at Pistoia, where the coinage in use
was ‘Pisans,’ the ‘gros tournois’ being worth 4s. 2d. of Pisan money.
The same currency continued in use in Florence and Siena, after
which ‘curteneys’ are introduced, the ‘gros tournois’ being worth 5s.
of this money, which, however, was only in use for two days, during
which halts were made at Acquapendente and Santa Cristina, a town
on the shore of the Lake of Bolsena, which name commemorates
that saint’s escape from martyrdom by drowning, thanks to the
miraculous buoyancy of her millstone, on which she floated to shore
as St. Piran floated on his stone to the delectable duchy of Cornwall.
After this the accounts are kept at Viterbo in ‘paperins,’ 3s. 4d. of
papal money being equivalent to the ‘gros tournois,’ changing next
day, for the last time on the way out, to ‘provis,’ at 2s. 10d. Passing
Sutri and Isola, Rome was reached on Whit Monday. Here they
found Master Thomas of Southwark, who had been sent on ahead to
hire lodgings and furniture, and here they spent six weeks.

‘St. Piran.’

Pope Boniface having agreed to act as arbiter between the Kings of


France and England, Sir Hugh de Vere’s mission was accomplished
and the embassy left Rome on the afternoon of Thursday, July 9, the
Count of Savoy accompanying them as far as Isola, their first
halting-place. The route followed as far as Pistoia was the same as
that taken on the way out, but by rather shorter stages, as several
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like