Professional Documents
Culture Documents
Full Chapter C Recipes A Problem Solution Approach 1St Edition Shirish Chavan PDF
Full Chapter C Recipes A Problem Solution Approach 1St Edition Shirish Chavan PDF
https://textbookfull.com/product/android-recipes-a-problem-
solution-approach-dave-smith/
https://textbookfull.com/product/raku-recipes-a-problem-solution-
approach-j-j-merelo/
https://textbookfull.com/product/javascript-recipes-a-problem-
solution-approach-1st-edition-russ-ferguson/
https://textbookfull.com/product/wxpython-recipes-a-problem-
solution-approach-1st-edition-mike-driscoll/
MATLAB Recipes: a problem-solution approach 2nd Edition
Michael Paluszek
https://textbookfull.com/product/matlab-recipes-a-problem-
solution-approach-2nd-edition-michael-paluszek/
https://textbookfull.com/product/prestashop-recipes-a-problem-
solution-approach-1st-edition-arnaldo-perez-castano-auth/
https://textbookfull.com/product/java-ee-7-recipes-a-problem-
solution-approach-1st-edition-juneau-josh/
https://textbookfull.com/product/java-9-recipes-a-problem-
solution-approach-3rd-edition-josh-juneau/
https://textbookfull.com/product/spring-5-recipes-a-problem-
solution-approach-4th-edition-marten-deinum/
C Recipes
A Problem-Solution Approach
—
Shirish Chavan
C Recipes
A Problem-Solution Approach
Shirish Chavan
C Recipes: A Problem-Solution Approach
Shirish Chavan
Sangli, Maharashtra, India
ISBN-13 (pbk): 978-1-4842-2966-8 ISBN-13 (electronic): 978-1-4842-2967-5
DOI 10.1007/978-1-4842-2967-5
Library of Congress Control Number: 2017950166
Copyright © 2017 by Shirish Chavan
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole
or part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical
way, and transmission or information storage and retrieval, electronic adaptation, computer
software, or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the
date of publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Cover image designed by Freepik
Managing Director: Welmoed Spahr
Editorial Director: Todd Green
Acquisitions Editor: Celestin Suresh John
Development Editor: Matthew Moodie
Technical Reviewer: Yogesh Sharma
Coordinating Editor: Prachi Mehta
Copy Editor: Kim Wimpsett
Compositor: SPi Global
Indexer: SPi Global
Artist: SPi Global
Distributed to the book trade worldwide by Springer Science+Business Media New York,
233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201)
348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress
Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business
Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail rights@apress.com, or visit
www.apress.com/rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our
Print and eBook Bulk Sales web page at www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this
book is available to readers on GitHub via the book's product page, located at
www.apress.com/978-1-4842-2966-8. For more detailed information, please visit
www.apress.com/source-code.
Printed on acid-free paper
This is dedicated to
Honorable Dr. Patangrao Kadam,
Chancellor at Bharati Vidyapeeth University in Pune.
—Shirish Chavan
Contents at a Glance
■
■Chapter 1: Welcome to C���������������������������������������������������������������� 1
■
■Chapter 2: Control Statements����������������������������������������������������� 13
■
■Chapter 3: Functions and Arrays�������������������������������������������������� 39
■
■Chapter 4: Pointers and Arrays���������������������������������������������������� 75
■
■Chapter 5: Functions and Structures with Pointers������������������� 119
■
■Chapter 6: Data Files������������������������������������������������������������������ 149
■
■Chapter 7: Self-Referential Structures��������������������������������������� 213
■
■Chapter 8: Stacks and Queues���������������������������������������������������� 253
■
■Chapter 9: Searching and Sorting���������������������������������������������� 277
■
■Chapter 10: Cryptographic Systems������������������������������������������� 301
■
■Chapter 11: Numerical Methods������������������������������������������������� 349
v
■ Contents at a Glance
■
■Appendix A: Reference Tables���������������������������������������������������� 403
■
■Appendix B: Library Functions��������������������������������������������������� 415
■
■Appendix C: C Idioms������������������������������������������������������������������ 421
■
■Appendix D: Glossary of Terms��������������������������������������������������� 431
Index���������������������������������������������������������������������������������������������� 439
vi
Contents
■
■Chapter 1: Welcome to C���������������������������������������������������������������� 1
Programs, Software, and Operating System������������������������������������������� 2
Machine Language and Assembly Language������������������������������������������ 2
Procedural Languages����������������������������������������������������������������������������� 3
Object-Oriented Languages��������������������������������������������������������������������� 3
Terminology in Computers���������������������������������������������������������������������� 4
Compiled and Interpreted Languages����������������������������������������������������� 4
Compilation��������������������������������������������������������������������������������������������������������������� 5
Interpretation������������������������������������������������������������������������������������������������������������ 5
■
■Chapter 2: Control Statements����������������������������������������������������� 13
Selection Statements���������������������������������������������������������������������������� 13
Iteration Statements������������������������������������������������������������������������������ 13
Jump Statements���������������������������������������������������������������������������������� 13
vii
■ Contents
viii
■ Contents
■
■Chapter 3: Functions and Arrays�������������������������������������������������� 39
3-1. Determine the Value of Pi�������������������������������������������������������������� 41
Problem������������������������������������������������������������������������������������������������������������������ 41
Solution������������������������������������������������������������������������������������������������������������������ 41
How It Works����������������������������������������������������������������������������������������������������������� 42
ix
■ Contents
x
■ Contents
■
■Chapter 4: Pointers and Arrays���������������������������������������������������� 75
4-1. Retrieve Data from an Array with the int Type Data����������������������� 75
Problem������������������������������������������������������������������������������������������������������������������ 75
Solution������������������������������������������������������������������������������������������������������������������ 75
How It Works����������������������������������������������������������������������������������������������������������� 76
4-3. Retrieve Data from an Array with char and double Type Data������� 80
Problem������������������������������������������������������������������������������������������������������������������ 80
Solution������������������������������������������������������������������������������������������������������������������ 80
How It Works����������������������������������������������������������������������������������������������������������� 82
xi
■ Contents
xii
■ Contents
■
■Chapter 5: Functions and Structures with Pointers������������������� 119
5-1. Pass Arguments by Reference to a Function������������������������������� 119
Problem���������������������������������������������������������������������������������������������������������������� 119
Solution���������������������������������������������������������������������������������������������������������������� 119
How It Works��������������������������������������������������������������������������������������������������������� 121
xiii
■ Contents
xiv
■ Contents
■
■Chapter 6: Data Files������������������������������������������������������������������ 149
6-1. Read a Text File Character by Character�������������������������������������� 149
Problem���������������������������������������������������������������������������������������������������������������� 149
Solution���������������������������������������������������������������������������������������������������������������� 149
How It Works��������������������������������������������������������������������������������������������������������� 150
xv
■ Contents
xvi
■ Contents
xvii
■ Contents
6-19. Write to a File and Then Read from That File����������������������������� 197
Problem���������������������������������������������������������������������������������������������������������������� 197
Solution���������������������������������������������������������������������������������������������������������������� 197
How It Works��������������������������������������������������������������������������������������������������������� 198
■
■Chapter 7: Self-Referential Structures��������������������������������������� 213
7-1. Generate Lists of Numbers in an Interactive Manner������������������ 213
Problem���������������������������������������������������������������������������������������������������������������� 213
Solution���������������������������������������������������������������������������������������������������������������� 214
How It Works��������������������������������������������������������������������������������������������������������� 215
xviii
■ Contents
xix
■ Contents
■
■Chapter 8: Stacks and Queues���������������������������������������������������� 253
8-1. Implement a Stack as an Array���������������������������������������������������� 254
Problem���������������������������������������������������������������������������������������������������������������� 254
Solution���������������������������������������������������������������������������������������������������������������� 254
How It Works��������������������������������������������������������������������������������������������������������� 258
8-2. Implement a Stack as a Linked List��������������������������������������������� 258
Problem���������������������������������������������������������������������������������������������������������������� 258
Solution���������������������������������������������������������������������������������������������������������������� 258
How It Works��������������������������������������������������������������������������������������������������������� 263
■
■Chapter 9: Searching and Sorting���������������������������������������������� 277
9-1. Find a Data Element Using a Linear Search��������������������������������� 278
Problem���������������������������������������������������������������������������������������������������������������� 278
Solution���������������������������������������������������������������������������������������������������������������� 278
How It Works��������������������������������������������������������������������������������������������������������� 280
xx
■ Contents
xxi
■ Contents
■
■Chapter 10: Cryptographic Systems������������������������������������������� 301
10-1. Use the Reverse Cipher Method������������������������������������������������ 303
Problem���������������������������������������������������������������������������������������������������������������� 303
Solution���������������������������������������������������������������������������������������������������������������� 304
How It Works��������������������������������������������������������������������������������������������������������� 306
10-2. Use the Caesar Cipher Method�������������������������������������������������� 307
Problem���������������������������������������������������������������������������������������������������������������� 307
Solution���������������������������������������������������������������������������������������������������������������� 307
How It Works��������������������������������������������������������������������������������������������������������� 310
xxii
■ Contents
■
■Chapter 11: Numerical Methods������������������������������������������������� 349
11-1. To Find the Roots of an Equation Using the Bisection Method��� 350
Problem���������������������������������������������������������������������������������������������������������������� 350
Solution���������������������������������������������������������������������������������������������������������������� 350
How It Works��������������������������������������������������������������������������������������������������������� 352
xxiii
■ Contents
xxiv
■ Contents
xxv
■ Contents
■
■Appendix A: Reference Tables���������������������������������������������������� 403
■
■Appendix B: Library Functions��������������������������������������������������� 415
Character Testing and Processing Functions�������������������������������������� 415
String Processing Functions��������������������������������������������������������������� 416
Mathematical Functions���������������������������������������������������������������������� 417
Utility Functions����������������������������������������������������������������������������������� 419
■
■Appendix C: C Idioms������������������������������������������������������������������ 421
■
■Appendix D: Glossary of Terms��������������������������������������������������� 431
Index���������������������������������������������������������������������������������������������� 439
xxvi
About the Author
xxvii
About the Technical
Reviewer
xxix
Acknowledgments
Thanks to everyone working at Apress who made this book possible. I am particularly
thankful to Mr. Celestin Suresh John, acquisitions editor, and Ms. Prachi Mehta,
coordinating editor, for their patience and guidance.
A good number of my techie friends helped me on technical matters in this book.
Notable among them are Mr. Ajay Dhande, CEO of Cryptex Technologies in Nagpur
(www.cryptextechnologies.com); Prof. Shivajirao Salunkhe and Prof. Manisha
Salunkhe of Harsh Computer Institute in Satara; Dr. Vilas Pharande, Principal at
Arvind Gavali College of Engineering in Satara (www.agce.sets.edu.in); Prof. Sachin
Pratapure and Prof. Vishal Khade at Kalasagar Academy (www.kalasagaracademy.in)
in Wai, Satara; Prof. Anant Bodas and Prof. Vikas Dhane at Yashoda College of
Engineering in Satara; Prof. Sanjay Adhau of Shrikant Computer Training Center,
Amravati (https://www.sctcamravati.com); Dr. Mir Sadique Ali, Principal, P R M I T
& R, Amravati (mitra.ac.in); and Mr. Nikhil Kumbhar, CEO of Aphron Infotech in Pune
(www.aphroninfotech.in). I am also thankful to Mr. Tushar Soni and Mr. Ajay Sawant,
who run the web site Coding Alpha (www.codingalpha.com), and Mr. Neeraj Mishra,
who runs the web site The Crazy Programmer (www.thecrazyprogrammer.com), for their
valuable help in the making of this book.
Dr. Vijay Bhatkar, eminent computer scientist and father of the Indian
supercomputer PARAM 10000, has been a source of inspiration for me. I am grateful to
him for inspiring me.
Last but not least, I am always thankful to Mr. Jarron & Mr. John Borges and their
active Technical Book Services team in Pune for the prompt supply of books.
Thank you, Sirs and Madams, you all made this book possible. Finally, a note: Pune,
Nagpur, and Satara are cities in Maharashtra, India.
xxxi
Another random document with
no related content on Scribd:
memory of Burns,—every man’s, every boy’s and girl’s head carries
snatches of his songs, and they say them by heart, and, what is
strangest of all, never learned them from a book, but from mouth to
mouth. The wind whispers them, the birds whistle them, the corn,
barley, and bulrushes hoarsely rustle them, nay, the music-boxes at
Geneva are framed and toothed to play them; the hand-organs of the
Savoyards in all cities repeat them, and the chimes of bells ring them
in the spires. They are the property and the solace of mankind.[213]
XXIII
REMARKS
SHAKSPEARE
’Tis not our fault if we have not made this evening’s circle still
richer than it is. We seriously endeavored, besides our brothers and
our seniors, on whom the ordinary lead of literary and social action
falls—and falls because of their ability—to draw out of their
retirements a few rarer lovers of the muse—“seld-seen flamens”—
whom this day seemed to elect and challenge. And it is to us a
painful disappointment that Bryant and Whittier as guests, and our
own Hawthorne,—with the best will to come,—should have found it
impossible at last; and again, that a well-known and honored
compatriot, who first in Boston wrote elegant verse, and on
Shakspeare, and whose American devotion through forty or fifty
years to the affairs of a bank, has not been able to bury the fires of
his genius,—Mr. Charles Sprague,—pleads the infirmities of age as
an absolute bar to his presence with us.
We regret also the absence of our members Sumner and Motley.
We can hardly think of an occasion where so little need be said.
We are all content to let Shakspeare speak for himself. His fame is
settled on the foundations of the moral and intellectual world.
Wherever there are men, and in the degree in which they are civil—
have power of mind, sensibility to beauty, music, the secrets of
passion, and the liquid expression of thought, he has risen to his
place as the first poet of the world.
Genius is the consoler of our mortal condition, and Shakspeare
taught us that the little world of the heart is vaster, deeper and richer
than the spaces of astronomy. What shocks of surprise and
sympathetic power, this battery, which he is, imparts to every fine
mind that is born! We say to the young child in the cradle, ‘Happy,
and defended against Fate! for here is Nature, and here is
Shakspeare, waiting for you!’
’Tis our metre of culture. He is a cultivated man—who can tell us
something new of Shakspeare. All criticism is only a making of rules
out of his beauties. He is as superior to his countrymen, as to all
other countrymen. He fulfilled the famous prophecy of Socrates, that
the poet most excellent in tragedy would be most excellent in
comedy, and more than fulfilled it by making tragedy also a victorious
melody which healed its own wounds. In short, Shakspeare is the
one resource of our life on which no gloom gathers; the fountain of
joy which honors him who tastes it; day without night; pleasure
without repentance; the genius which, in unpoetic ages, keeps
poetry in honor and, in sterile periods, keeps up the credit of the
human mind.
His genius has reacted on himself. Men were so astonished and
occupied by his poems that they have not been able to see his face
and condition, or say, who was his father and his brethren; or what
life he led; and at the short distance of three hundred years he is
mythical, like Orpheus and Homer, and we have already seen the
most fantastic theories plausibly urged, as that Raleigh and Bacon
were the authors of the plays.
Yet we pause expectant before the genius of Shakspeare—as if
his biography were not yet written; until the problem of the whole
English race is solved.
I see, among the lovers of this catholic genius, here present, a
few, whose deeper knowledge invites me to hazard an article of my
literary creed; that Shakspeare, by his transcendant reach of
thought, so unites the extremes, that, whilst he has kept the theatre
now for three centuries, and, like a street-bible, furnishes sayings to
the market, courts of law, the senate, and common discourse,—he is
yet to all wise men the companion of the closet. The student finds
the solitariest place not solitary enough to read him; and so
searching is his penetration, and such the charm of his speech, that
he still agitates the heart in age as in youth, and will, until it ceases
to beat.
Young men of a contemplative turn carry his sonnets in the pocket.
With that book, the shade of any tree, a room in any inn, becomes a
chapel or oratory in which to sit out their happiest hours. Later they
find riper and manlier lessons in the plays.
And secondly, he is the most robust and potent thinker that ever
was. I find that it was not history, courts and affairs that gave him
lessons, but he that gave grandeur and prestige to them. There
never was a writer who, seeming to draw every hint from outward
history, the life of cities and courts, owed them so little. You shall
never find in this world the barons or kings he depicted. ’Tis fine for
Englishmen to say, they only know history by Shakspeare. The
palaces they compass earth and sea to enter, the magnificence and
personages of royal and imperial abodes, are shabby imitations and
caricatures of his,—clumsy pupils of his instruction. There are no
Warwicks, no Talbots, no Bolingbrokes, no Cardinals, no Harry Fifth,
in real Europe, like his. The loyalty and royalty he drew were all his
own. The real Elizabeths, Jameses and Louises were painted sticks
before this magician.
The unaffected joy of the comedy,—he lives in a gale,—contrasted
with the grandeur of the tragedy, where he stoops to no contrivance,
no pulpiting, but flies an eagle at the heart of the problem; where his
speech is a Delphi,—the great Nemesis that he is and utters. What a
great heart of equity is he! How good and sound and inviolable his
innocency, that is never to seek, and never wrong, but speaks the
pure sense of humanity on each occasion. He dwarfs all writers
without a solitary exception. No egotism. The egotism of men is
immense. It concealed Shakspeare for a century. His mind has a
superiority such that the universities should read lectures on him,
and conquer the unconquerable if they can.
There are periods fruitful of great men; others, barren; or, as the
world is always equal to itself, periods when the heat is latent,—
others when it is given out.
They are like the great wine years,—the vintage of 1847, is it? or
1835?—which are not only noted in the carte of the table d’hôte, but
which, it is said, are always followed by new vivacity in the politics of
Europe. His birth marked a great wine year when wonderful grapes
ripened in the vintage of God, when Shakspeare and Galileo were
born within a few months of each other, and Cervantes was his exact
contemporary, and, in short space before and after, Montaigne,
Bacon, Spenser, Raleigh and Jonson. Yet Shakspeare, not by any
inferiority of theirs, but simply by his colossal proportions, dwarfs the
geniuses of Elizabeth as easily as the wits of Anne, or the poor
slipshod troubadours of King René.
In our ordinary experience of men there are some men so born to
live well that, in whatever company they fall,—high or low,—they fit
well, and lead it! but, being advanced to a higher class, they are just
as much in their element as before, and easily command: and being
again preferred to selecter companions, find no obstacle to ruling
these as they did their earlier mates; I suppose because they have
more humanity than talent, whilst they have quite as much of the last
as any of the company. It would strike you as comic, if I should give
my own customary examples of this elasticity, though striking
enough to me. I could name in this very company—or not going far
out of it—very good types, but in order to be parliamentary, Franklin,
Burns and Walter Scott are examples of the rule; and king of men, by
this grace of God also, is Shakspeare.
The Pilgrims came to Plymouth in 1620. The plays of Shakspeare
were not published until three years later. Had they been published
earlier, our forefathers, or the most poetical among them, might have
stayed at home to read them.
XXIV
HUMBOLDT
HUMBOLDT
Humboldt was one of those wonders of the world, like Aristotle,
like Julius Cæsar, like the Admirable Crichton, who appear from time
to time, as if to show us the possibilities of the human mind, the force
and the range of the faculties,—a universal man, not only possessed
of great particular talents, but they were symmetrical, his parts were
well put together. As we know, a man’s natural powers are often a
sort of committee that slowly, one at a time, give their attention and
action; but Humboldt’s were all united, one electric chain, so that a
university, a whole French Academy, travelled in his shoes. With
great propriety, he named his sketch of the results of science
Cosmos. There is no other such survey or surveyor. The wonderful
Humboldt, with his solid centre and expanded wings, marches like
an army, gathering all things as he goes. How he reaches from
science to science, from law to law, folding away moons and
asteroids and solar systems in the clauses and parentheses of his
encyclopædic paragraphs! There is no book like it; none indicating
such a battalion of powers. You could not put him on any sea or
shore but his instant recollection of every other sea or shore
illuminated this.
He was properly a man of the world; you could not lose him; you
could not detain him; you could not disappoint him, for at any point
on land or sea he found the objects of his researches. When he was
stopped in Spain and could not get away, he turned round and
interpreted their mountain system, explaining the past history of the
continent of Europe. He belonged to that wonderful German nation,
the foremost scholars in all history, who surpass all others in
industry, space and endurance. A German reads a literature whilst
we are reading a book. One of their writers warns his countrymen
that it is not the Battle of Leipsic, but the Leipsic Fair Catalogue,
which raises them above the French. I remember Cuvier tells us of
fossil elephants; that Germany has furnished the greatest number;—
not because there are more elephants in Germany,—oh no; but
because in that empire there is no canton without some well-
informed person capable of making researches and publishing
interesting results. I know that we have been accustomed to think
they were too good scholars, that because they reflect, they never
resolve, that “in a crisis no plan-maker was to be found in the
empire;” but we have lived to see now, for the second time in the
history of Prussia, a statesman of the first class, with a clear head
and an inflexible will.
XXV
WALTER SCOTT
WALTER SCOTT
The memory of Sir Walter Scott is dear to this Society, of which he
was for ten years an honorary member. If only as an eminent
antiquary who has shed light on the history of Europe and of the
English race, he had high claims to our regard. But to the rare tribute
of a centennial anniversary of his birthday, which we gladly join with
Scotland, and indeed with Europe, to keep, he is not less entitled—
perhaps he alone among literary men of this century is entitled—by
the exceptional debt which all English-speaking men have gladly
owed to his character and genius. I think no modern writer has
inspired his readers with such affection to his own personality. I can
well remember as far back as when The Lord of the Isles was first
republished in Boston, in 1815,—my own and my school-fellows’ joy
in the book.[214] Marmion and The Lay had gone before, but we
were then learning to spell. In the face of the later novels, we still
claim that his poetry is the delight of boys. But this means that when
we reopen these old books we all consent to be boys again. We
tread over our youthful grounds with joy. Critics have found them to
be only rhymed prose. But I believe that many of those who read
them in youth, when, later, they come to dismiss finally their school-
days’ library, will make some fond exception for Scott as for Byron.
It is easy to see the origin of his poems. His own ear had been
charmed by old ballads crooned by Scottish dames at firesides, and
written down from their lips by antiquaries; and finding them now
outgrown and dishonored by the new culture, he attempted to dignify
and adapt them to the times in which he lived. Just so much thought,
so much picturesque detail in dialogue or description as the old
ballad required, so much suppression of details and leaping to the
event, he would keep and use, but without any ambition to write a
high poem after a classic model. He made no pretension to the lofty
style of Spenser, or Milton, or Wordsworth. Compared with their
purified songs, purified of all ephemeral color or material, his were
vers de société. But he had the skill proper to vers de société,—skill
to fit his verse to his topic, and not to write solemn pentameters alike
on a hero or a spaniel. His good sense probably elected the ballad to
make his audience larger. He apprehended in advance the immense
enlargement of the reading public, which almost dates from the era
of his books,—which his books and Byron’s inaugurated; and which,
though until then unheard of, has become familiar to the present
time.
If the success of his poems, however large, was partial, that of his
novels was complete. The tone of strength in Waverley at once
announced the master, and was more than justified by the superior
genius of the following romances, up to the Bride of Lammermoor,
which almost goes back to Æschylus for a counterpart as a painting
of Fate,—leaving on every reader the impression of the highest and
purest tragedy.[215]
His power on the public mind rests on the singular union of two
influences. By nature, by his reading and taste an aristocrat, in a
time and country which easily gave him that bias, he had the virtues
and graces of that class, and by his eminent humanity and his love
of labor escaped its harm. He saw in the English Church the symbol
and seal of all social order; in the historical aristocracy the benefits to
the state which Burke claimed for it; and in his own reading and
research such store of legend and renown as won his imagination to
their cause. Not less his eminent humanity delighted in the sense
and virtue and wit of the common people. In his own household and
neighbors he found characters and pets of humble class, with whom
he established the best relation,—small farmers and tradesmen,
shepherds, fishermen, gypsies, peasant-girls, crones,—and came
with these into real ties of mutual help and good will. From these
originals he drew so genially his Jeanie Deans, his Dinmonts and
Edie Ochiltrees, Caleb Balderstones and Fairservices, Cuddie
Headriggs, Dominies, Meg Merrilies, and Jenny Rintherouts, full of
life and reality; making these, too, the pivots on which the plots of his
stories turn; and meantime without one word of brag of this
discernment,—nay, this extreme sympathy reaching down to every
beggar and beggar’s dog, and horse and cow. In the number and
variety of his characters he approaches Shakspeare. Other painters
in verse or prose have thrown into literature a few type-figures; as
Cervantes, De Foe, Richardson, Goldsmith, Sterne and Fielding; but
Scott portrayed with equal strength and success every figure in his
crowded company.
His strong good sense saved him from the faults and foibles
incident to poets,—from nervous egotism, sham modesty or
jealousy. He played ever a manly part.[216] With such a fortune and
such a genius, we should look to see what heavy toll the Fates took
of him, as of Rousseau or Voltaire, of Swift or Byron. But no: he had
no insanity, or vice, or blemish. He was a thoroughly upright, wise
and great-hearted man, equal to whatever event or fortune should try
him. Disasters only drove him to immense exertion. What an
ornament and safeguard is humor! Far better than wit for a poet and
writer. It is a genius itself, and so defends from the insanities.
Under what rare conjunction of stars was this man born, that,
wherever he lived, he found superior men, passed all his life in the
best company, and still found himself the best of the best! He was
apprenticed at Edinburgh to a Writer to the Signet, and became a
Writer to the Signet, and found himself in his youth and manhood
and age in the society of Mackintosh, Horner, Jeffrey, Playfair,
Dugald Stewart, Sydney Smith, Leslie, Sir William Hamilton, Wilson,
Hogg, De Quincey,—to name only some of his literary neighbors,
and, as soon as he died, all this brilliant circle was broken up.
XXVI
SPEECH
SPEECH
AT THE BANQUET IN HONOR OF THE CHINESE EMBASSY
REMARKS
AT THE MEETING FOR ORGANIZING THE FREE RELIGIOUS ASSOCIATION
Mr. Chairman: I hardly felt, in finding this house this morning, that
I had come into the right hall. I came, as I supposed myself
summoned, to a little committee meeting, for some practical end,
where I should happily and humbly learn my lesson; and I supposed
myself no longer subject to your call when I saw this house. I have
listened with great pleasure to the lessons which we have heard. To
many, to those last spoken, I have found so much in accord with my
own thought that I have little left to say. I think that it does great
honor to the sensibility of the committee that they have felt the
universal demand in the community for just the movement they have
begun. I say again, in the phrase used by my friend, that we began
many years ago,—yes, and many ages before that. But I think the
necessity very great, and it has prompted an equal magnanimity, that
thus invites all classes, all religious men, whatever their connections,
whatever their specialties, in whatever relation they stand to the
Christian Church, to unite in a movement of benefit to men, under
the sanction of religion. We are all very sensible—it is forced on us
every day—of the feeling that churches are outgrown; that the
creeds are outgrown; that a technical theology no longer suits us. It
is not the ill will of people—no, indeed, but the incapacity for
confining themselves there. The church is not large enough for the
man; it cannot inspire the enthusiasm which is the parent of
everything good in history, which makes the romance of history. For
that enthusiasm you must have something greater than yourselves,
and not less.
The child, the young student, finds scope in his mathematics and
chemistry or natural history, because he finds a truth larger than he
is; finds himself continually instructed. But, in churches, every
healthy and thoughtful mind finds itself in something less; it is
checked, cribbed, confined. And the statistics of the American, the
English and the German cities, showing that the mass of the
population is leaving off going to church, indicate the necessity,
which should have been foreseen, that the Church should always be
new and extemporized, because it is eternal and springs from the
sentiment of men, or it does not exist.[217] One wonders sometimes
that the churches still retain so many votaries, when he reads the
histories of the Church. There is an element of childish infatuation in
them which does not exalt our respect for man. Read in Michelet,
that in Europe, for twelve or fourteen centuries, God the Father had
no temple and no altar. The Holy Ghost and the Son of Mary were
worshipped, and in the thirteenth century the First Person began to
appear at the side of his Son, in pictures and in sculpture, for
worship, but only through favor of his Son. These mortifying
puerilities abound in religious history. But as soon as every man is
apprised of the Divine Presence within his own mind,—is apprised
that the perfect law of duty corresponds with the laws of chemistry, of
vegetation, of astronomy, as face to face in a glass; that the basis of
duty, the order of society, the power of character, the wealth of
culture, the perfection of taste, all draw their essence from this moral
sentiment, then we have a religion that exalts, that commands all the
social and all the private action.
What strikes me in the sudden movement which brings together
to-day so many separated friends,—separated but sympathetic,—
and what I expected to find here, was some practical suggestions by
which we were to reanimate and reorganize for ourselves the true
Church, the pure worship. Pure doctrine always bears fruit in pure
benefits. It is only by good works, it is only on the basis of active
duty, that worship finds expression. What is best in the ancient
religions was the sacred friendships between heroes, the Sacred
Bands, and the relations of the Pythagorean disciples. Our Masonic
institutions probably grew from the like origin. The close association
which bound the first disciples of Jesus is another example; and it
were easy to find more. The soul of our late war, which will always
be remembered as dignifying it, was, first, the desire to abolish
slavery in this country, and secondly, to abolish the mischief of the
war itself, by healing and saving the sick and wounded soldiers,—
and this by the sacred bands of the Sanitary Commission. I wish that
the various beneficent institutions which are springing up, like joyful
plants of wholesomeness, all over this country, should all be
remembered as within the sphere of this committee,—almost all of
them are represented here,—and that within this little band that has
gathered here to-day, should grow friendship. The interests that grow
out of a meeting like this should bind us with new strength to the old
eternal duties.
XXVIII
SPEECH
SPEECH
AT SECOND ANNUAL MEETING OF THE FREE RELIGIOUS ASSOCIATION