C Programming Building Blocks Of Modern Code Edet Theophilus pdf download
C Programming Building Blocks Of Modern Code Edet Theophilus pdf download
https://ebookbell.com/product/c-programming-building-blocks-of-
modern-code-edet-theophilus-54936130
https://ebookbell.com/product/pro-tbb-c-parallel-programming-with-
threading-building-blocks-1st-edition-michael-voss-50195056
https://ebookbell.com/product/learning-c-7-by-developing-games-with-
unity-2017-learn-c-programming-by-building-fun-and-interactive-games-
with-unity-third-edition-3rd-edition-micael-dagraca-greg-
lukosek-7250930
https://ebookbell.com/product/handson-game-development-with-
webassembly-learn-webassembly-c-programming-by-building-a-retro-space-
game-1st-edition-rick-battagline-36528724
https://ebookbell.com/product/programming-c-building-net-
applicationscover-updated-for-vsnet-10cover-includes-index-2nd-ed-
jesse-liberty-4106468
Programming C Building Net Applications With C 4th Edition Jesse
Liberty
https://ebookbell.com/product/programming-c-building-net-applications-
with-c-4th-edition-jesse-liberty-925808
https://ebookbell.com/product/c-programming-handbook-for-beginners-on-
gui-development-with-qt-a-stepbystep-guide-to-building-crossplatform-
gui-applications-using-c-and-qt-framework-1st-edition-tech-
greeny-220579132
https://ebookbell.com/product/learning-c-by-developing-games-with-
unity-2021-kickstart-your-c-programming-and-unity-journey-by-
building-3d-games-from-scrat-sixth-edition-harrison-ferrone-47965372
https://ebookbell.com/product/diy-microcontroller-projects-for-
hobbyists-the-ultimate-projectbased-guide-to-building-realworld-
embedded-applications-in-c-and-c-programming-1st-edition-miguel-angel-
garciaruiz-33789590
https://ebookbell.com/product/programming-firefox-building-
applications-in-the-browser-1st-edition-kenneth-c-feldt-36702404
C Programming: Building Blocks of Modern Code
By Theophilus Edet
Theophilus Edet
theoedet@yahoo.com
facebook.com/theoedet
twitter.com/TheophilusEdet
Instagram.com/edettheophilus
Copyright © 2023 Theophilus Edet All rights reserved.
No part of this publication may be reproduced, distributed, or transmitted in any form or by any
means, including photocopying, recording, or other electronic or mechanical methods, without the
prior written permission of the publisher, except in the case of brief quotations embodied in reviews
and certain other non-commercial uses permitted by copyright law.
Table of Contents
Preface
C Programming: Building Blocks of Modern Code
Module 2: Variables in C
Data Types and Declarations
Memory Allocation
Constants and Literals
Dynamic Memory Allocation
Module 3: Functions in C
Function Declaration and Definition
Parameters and Return Values
Function Prototypes
Recursion in C
Module 5: Collections in C
Arrays and Pointers
Strings in C
Multi-dimensional Arrays
Dynamic Arrays
Module 6: Loops in C
while Loop
for Loop
do-while Loop
Loop Control Statements
Module 8: Enumerations in C
Introduction to Enums
Creating Enums
Enum Applications in C
Best Practices for Enum Usage
Module 9: Classes in C
Overview of Object-Oriented Programming in C
Defining and Using Classes
Constructors and Destructors
Encapsulation in C
Review Request
Embark on a Journey of ICT Mastery with CompreQuest Books
Welcome to the fascinating journey into the world of C
Preface programming, where the essence of modern code creation
unfolds through the pages of this comprehensive guide. In the
rapidly evolving landscape of technology, C remains an unparalleled
language, and this book aims to be your trusted companion in mastering its
intricacies.
Exploring the Essence of the Book:
"C Programming: Building Blocks of Modern Code" is not just another
programming manual; it is a roadmap for harnessing the power of C to
build robust and efficient modern code. This book is meticulously crafted to
provide a thorough understanding of C programming concepts, with a focus
on their relevance in contemporary software development.
Pedagogical Style of Presentation:
Learning programming is a transformative journey, and we understand that
effective teaching requires clarity, engagement, and practical relevance. The
pedagogical style adopted in this book is designed to make complex
concepts accessible to learners of all levels. We believe in the power of
hands-on learning, and each module is enriched with examples, exercises,
and real-world applications to reinforce theoretical knowledge.
What Readers Stand to Benefit:
Whether you are a novice programmer or an experienced developer, this
book offers valuable insights and practical skills. Novices will find a
structured and approachable introduction to C, while experienced
programmers can delve into advanced topics and modern coding practices.
The book caters to diverse learning styles, providing a solid foundation for
everyone.
Readers can expect to gain proficiency in:
Theophilus Edet
C Programming: Building Blocks of
Modern Code
Introduction to C Programming: Building Blocks of Modern Code
C Programming stands as a cornerstone in the realm of computer
programming, and the book "C Programming: Building Blocks of Modern
Code" delves into its intricacies, providing a comprehensive guide to both
novice and experienced programmers. This timeless language, created by
Dennis Ritchie in the early 1970s, has left an indelible mark on the software
development landscape. Its influence extends far beyond its inception,
shaping the foundations of modern computing.
C as a Versatile Programming Language
At its core, C is celebrated for its versatility. It serves as the progenitor of
numerous programming languages, owing to its simplicity, efficiency, and
expressiveness. The book begins by elucidating the fundamental principles
that make C an ideal choice for myriad applications. Whether crafting
system-level software, embedded systems, or high-performance
applications, C's flexibility empowers programmers to wield it as a
powerful tool in their arsenal.
Programming Models and Paradigms
The strength of C lies not only in its syntax but also in its support for
various programming models and paradigms. The book navigates through
these, unraveling the layers of procedural programming where C excels.
With a focus on procedural abstraction, the book elucidates how C allows
developers to structure code in a modular fashion, fostering code reusability
and maintainability.
Moving beyond procedural programming, the book explores C's support for
imperative programming. Its ability to handle sequential execution with
clear control flow structures makes it an adept language for writing clear
and concise algorithms. Readers will gain insights into how C
accommodates imperative programming principles, providing a solid
foundation for algorithmic development.
Furthermore, the book ventures into the world of structured programming.
Here, C shines with its support for modular design, emphasizing the
creation of functions and structures to enhance code organization. The
paradigm of structured programming aligns seamlessly with C, promoting
code clarity and ease of maintenance.
As the journey through the book progresses, readers will encounter the
elegance of C in supporting low-level programming. From direct memory
manipulation to bit-level operations, C provides unparalleled control,
making it an indispensable language for system programming and
embedded systems development.
"C Programming: Building Blocks of Modern Code" is more than a guide;
it's a companion for those navigating the expansive landscape of C
programming. With a focus on applications, programming models, and
paradigms, this book aims to equip readers with the knowledge and skills
needed to harness the full potential of C and lay the foundation for robust,
efficient, and modern code.
Module 1:
Introduction to C Programming
Historical Overview
The Historical Overview of the Introduction to C Programming
module in the book "C Programming: Building Blocks of Modern
Code" provides a comprehensive journey through the evolution of the
C programming language. C, conceived by Dennis Ritchie at Bell
Labs in the early 1970s, emerged as a successor to the B
programming language. This section delves into the motivations
behind creating C and its early applications.
Birth of C Programming Language
In the late 1960s and early 1970s, computing faced challenges with
the proliferation of diverse hardware architectures. Developers
needed a versatile language that could adapt to different systems
without sacrificing performance. Dennis Ritchie, along with Ken
Thompson, began working on what would become the C language.
They aimed to create a portable and efficient tool for systems
programming, initially implementing it on the PDP-11.
Impact on Unix and Systems Programming
The section explores the symbiotic relationship between C and the
Unix operating system. C became the language of choice for
developing Unix, enabling the creation of a robust and portable
operating system. The Unix philosophy, favoring simplicity and
composability, aligns seamlessly with the design principles of C.
Together, they laid the foundation for modern systems programming,
influencing subsequent generations of operating systems.
Standardization and ANSI C
As C gained popularity, the need for standardization arose to ensure
compatibility across different implementations. The American
National Standards Institute (ANSI) played a pivotal role in
formalizing the language specifications. The book navigates through
the evolution of C standards, highlighting key features introduced in
each version. The significance of ANSI C lies in providing a common
ground for developers, fostering consistency and interoperability.
C in Embedded Systems and Real-Time Applications
Beyond its role in systems programming, C found a niche in
embedded systems and real-time applications. The Historical
Overview explores how C's efficiency and low-level control make it
well-suited for programming microcontrollers and other resource-
constrained environments. The section delves into practical examples
of C code for embedded systems, elucidating its relevance in modern
technological landscapes.
Legacy and Continued Relevance
The section concludes by emphasizing the enduring legacy of C.
Despite the emergence of newer languages, C continues to be a
fundamental building block of modern code. Its influence extends
beyond systems programming to various domains, including game
development, firmware, and high-performance computing. The
Historical Overview serves as a bridge between C's origins and its
enduring impact on contemporary software development.
int main() {
printf("Hello, World!\n");
return 0;
}
return 0;
}
Main Function
The heart of every C program is the main function. Execution starts
from the main function, making it a mandatory component. The main
function encapsulates the code that will be executed when the
program runs.
int main() {
// Code inside the main function
return 0;
}
The int before main indicates that the function returns an integer
value, conventionally used to convey the program's exit status.
Variables and Data Types
Following the main function, C programs often declare variables to
store and manipulate data. C supports various data types such as int,
float, and char. Declaring variables with specific data types helps in
efficient memory allocation.
int main() {
int age = 25;
float height = 5.9;
char grade = 'A';
// Additional variable declarations and code
return 0;
}
Functions
Beyond the main function, C programs can define additional
functions to modularize code. Functions promote code reuse and
maintainability. They consist of a return type, a function name,
parameters, and the function body.
int add(int a, int b) {
return a + b;
}
int main() {
int result = add(3, 7);
printf("Sum: %d\n", result);
return 0;
}
Here, the variable age is declared as an integer and assigned the value
25. Similarly, the float data type is employed for decimal or floating-
point values.
float height = 5.9;
The char data type is reserved for single characters, while double is
used for double-precision floating-point numbers.
char grade = 'A';
double pi = 3.14159;
The code snippet defines a structure named Point with two members
x and y. An instance p1 is then declared, representing a point in a
Cartesian coordinate system.
Pointers for Memory Management
Pointers are a powerful feature in C, allowing direct manipulation of
memory addresses. They enhance efficiency and flexibility but
require careful handling to avoid memory-related issues.
int num = 42;
int *ptr = #
In this example, a pointer ptr is declared to store the address of the
variable num. This provides a means to indirectly access and modify
the value of num through the pointer.
Type Modifiers
C includes type modifiers to adjust the range and nature of data types.
For instance, unsigned can be used to declare variables that only store
positive values, effectively doubling the positive range of int.
unsigned int positiveNumber = 100;
Memory Allocation
The "Variables in C" module within the book "C Programming:
Building Blocks of Modern Code" delves into the crucial concept of
memory allocation. Understanding how memory is allocated and
managed is essential for writing efficient and reliable C programs.
This section illuminates the different aspects of memory allocation,
from static allocation to dynamic allocation.
Static Memory Allocation
In C, memory can be statically allocated during compile-time.
Variables declared with a fixed size are assigned memory when the
program is compiled, and this memory remains constant throughout
the program's execution.
int count = 10; // Static memory allocation
Here, the program checks if the allocation was successful, and if not,
it prints an error message and exits the program.
The "Dynamic Memory Allocation" section provides a
comprehensive guide within the "Variables in C" module, offering
insights into the functions and practices related to allocating and
managing memory dynamically in C programs. Understanding these
concepts is fundamental for writing robust and memory-efficient C
code.
Module 3:
Functions in C
In this example, the add function adds two integers and returns the
result. The function definition includes the return type, function
name, parameter types, and the actual code within curly braces.
Function Prototypes
Function prototypes are a form of forward declaration, allowing the
compiler to recognize functions before their definitions appear in the
code. They are particularly useful when functions are defined after
they are called in the program.
// Function prototype
int multiply(int x, int y);
int main() {
int result = multiply(3, 4);
return 0;
}
// Function definition
int multiply(int x, int y) {
return x * y;
}
int main() {
modifyGlobalVariable();
// globalVariable is now 20
return 0;
}
int main() {
int number = 5;
square(number);
// 'number' remains 5 after the function call
return 0;
}
int main() {
int number = 5;
squareByReference(&number);
// 'number' is now 25 after the function call
return 0;
}
Here, the squareByReference function takes a pointer to an integer
and modifies the value at that memory address, affecting the original
variable number in the main function.
Return Values
Functions in C can return values to the calling code, allowing them to
communicate results or perform computations. The return type is
specified in the function declaration and definition.
// Function declaration with return type
float calculateAverage(int array[], int size);
int main() {
int numbers[] = {3, 7, 1, 9, 4};
int minValue, maxValue;
// minValue and maxValue now contain the minimum and maximum values,
respectively
return 0;
}
Here, the getMinMax function takes an array, its size, and two
pointers (min and max) to store the minimum and maximum values.
The function modifies the values indirectly through the pointers.
Understanding parameters and return values is fundamental for
harnessing the full potential of functions in C. The ability to pass data
into functions and receive results back enhances the modularity and
clarity of code, facilitating the creation of robust and reusable
software.
Function Prototypes
The module on "Functions in C" within the book "C Programming:
Building Blocks of Modern Code" introduces the concept of function
prototypes, a vital aspect of C programming that enhances code
organization and allows for better modularity. Function prototypes
serve as declarations that inform the compiler about the existence and
signature of a function before its actual implementation, enabling
smooth integration and avoiding potential issues related to function
calls.
Introduction to Function Prototypes
In C, a function prototype provides the compiler with information
about a function's name, return type, and parameters. This enables the
compiler to validate function calls and ensure their correctness before
the actual function definitions are encountered.
// Function prototype
int calculateSum(int a, int b);
int main() {
int result = calculateProduct(3, 4);
return 0;
}
// Function definition
int calculateProduct(int x, int y) {
return x * y;
}
In this example, the prototype informs the compiler about the
calculateProduct function, allowing the main function to call it before
its actual definition.
Avoiding Implicit Int Function Declarations
In older C standards, when a function was called without a prototype,
the compiler implicitly assumed it returned an int. This could lead to
subtle bugs if the function returned a different type.
// No prototype
double calculateAverage(int array[], int size);
int main() {
double result = calculateAverage(numbers, 5);
return 0;
}
// Function definition
double calculateAverage(int array[], int size) {
// Logic to calculate average
return sum / size;
}
#endif
Recursion in C
The module on "Functions in C" within the book "C Programming:
Building Blocks of Modern Code" explores the powerful concept of
recursion. Recursion is a programming technique where a function
calls itself, allowing for the repetition of a particular set of
operations. This section delves into the principles of recursion in C,
its applications, and considerations for effective implementation.
Understanding Recursion
Recursion simplifies complex problems by breaking them down into
smaller, more manageable sub-problems. The base case, a condition
where the function does not call itself, is crucial for preventing an
infinite loop. Each recursive call tackles a smaller part of the
problem, gradually converging towards the base case.
// Recursive function to calculate factorial
int factorial(int n) {
if (n == 0 || n == 1) {
return 1; // Base case
} else {
return n * factorial(n - 1); // Recursive call
}
}
if (num > 0) {
printf("The number is positive.\n");
}
In this example, the printf statement will only be executed if the
condition num > 0 is true. If the condition is false, the code block will
be skipped.
The else if Statement
The else if statement provides a way to test multiple conditions
sequentially. If the preceding if condition is false, the else if
statement allows the evaluation of an additional condition.
int num = 0;
if (num > 0) {
printf("The number is positive.\n");
} else if (num < 0) {
printf("The number is negative.\n");
} else {
printf("The number is zero.\n");
}
In this scenario, the program checks multiple conditions using else if.
If none of the conditions is true, the else block is executed, providing
a default case.
The else Statement
The else statement provides a fallback option when none of the
preceding conditions are true. It allows the execution of a default
block of code.
int num = -5;
if (num > 0) {
printf("The number is positive.\n");
} else {
printf("The number is non-positive.\n");
}
Here, if the condition num > 0 is false, the else block will be
executed, printing that the number is non-positive.
Nested if Statements
Conditional statements can be nested, allowing for more complex
decision-making scenarios. Nested if statements are useful when
multiple conditions need to be evaluated based on the outcome of
outer conditions.
int num = 10;
if (num > 0) {
if (num % 2 == 0) {
printf("The number is positive and even.\n");
} else {
printf("The number is positive and odd.\n");
}
} else {
printf("The number is non-positive.\n");
}
// Incorrect indentation
if (num > 0) {
printf("The number is positive.\n");
} else {
printf("The number is non-positive.\n");
}
Switch-Case Statements
The "Conditions and Decision Making" module in the book "C
Programming: Building Blocks of Modern Code" introduces the
switch-case statements, a powerful control structure designed to
simplify decision-making processes involving multiple possible
conditions. The switch-case construct provides an organized and
efficient way to handle various cases, offering an alternative to
cascading if-else if statements.
Introduction to Switch-Case
The switch-case structure is particularly useful when a program needs
to compare a variable or expression against multiple constant values
and execute different blocks of code based on the match. It improves
code readability and maintainability by avoiding the need for
extensive nested if-else constructs.
int dayOfWeek = 3;
switch (dayOfWeek) {
case 1:
printf("Monday\n");
break;
case 2:
printf("Tuesday\n");
break;
case 3:
printf("Wednesday\n");
break;
// Additional cases for other days
default:
Random documents with unrelated
content Scribd suggests to you:
For the Southern Literary Messenger.
Boston, 1832.
In dramatic literature, but little has yet been done in the United
States. Few appear to have devoted much of their attention to
dramatic composition. I have seen but ten or twelve American plays
in the course of my researches; and these, though they possessed a
good deal of merit, have been suffered to sink into neglect, and are
rarely performed. A much larger number, however, would appear to
have been written and prepared for the stage. According to a
catalogue I have lately seen, no less than 270 dramatic pieces have
either been prepared for the theatre of this country, or written by
Americans. Of these many were of course got up for temporary
purposes, and when these purposes were answered were no longer
remembered; but you will be surprised to learn that of this number,
commencing in 1775, there are no less than thirty-three tragedies,
the best of which are those which have been recently brought out,
Metamora, Ouralasqui, a prize tragedy by a lady of Kentucky, and a
combination of tragedies, by Paine, called Brutus, which has been on
the stage for several years. The rest are scarcely remembered. The
writer who seems to have devoted the largest portion of his time to
dramatic literature in this country and who may be called the father
of the American drama, is Mr. Dunlap, who has figured for many
years in the various characters of dramatist, manager, and painter.
His dramatic pieces amount to about 50, and he has already outlived
their fame. Some of his translations from the German are still
exhibited; but his original compositions are now never performed,
and are almost forgotten. Mr. J. N. Barker of Philadelphia, stands
next in point of fecundity, having given birth to ten dramatic
bantlings in the course of his life, some of which are very creditable
to their parent, but none are, I believe, stock plays. The prejudice
against native writers was at one time so strong that the managers
deemed it prudent to announce Mr. Barker's Marmion, Sir Walter's
poem dramatized, as the production of Thomas Morton the author of
Columbus. Mr. Dunlap was also I understand obliged to resort to the
same expedient in relation to two or three of his plays; but as moon
as it was known, their popularity, which had at first been
considerable, immediately ceased, and they were laid upon the shelf.
Such are some of the difficulties with which the American writer has
to struggle; but these I am happy to learn are now giving way, and a
more liberal spirit is beginning to prevail. It is to be hoped that the
dramatic muse of America will soon be enabled to triumph over all
the impediments which she has had to encounter, and repose in the
same bower and be crowned with the same chaplet as her more
fortunate sister of romance. Among the American plays which
accident brought under my notice, was a comedy in five acts,
entitled the "Child of Feeling," published in 1809, and written by a
citizen of Washington. It seems to have been a juvenile production,
written without much knowledge of the world, but with a due regard
to the unities. The dialogue wants sprightliness and the plot interest,
and I merely mention it now because its contains among its dramatis
personæ a character which is to me entirely original, and which if he
really existed, the author must I think have caricatured in his copy.
He is called Etymology, and does not belie his name, for he is
constantly occupied in tracing every word that is spoken by himself
or others to its root, and makes as may easily be supposed, some
comic and ludicrous blunders. Till very recently, the author of even a
successful play received scarcely any compensation for his labor, and
the fame he acquired was but of short duration. Now however, it is
otherwise, and both reputation and emolument attend the successful
dramatist. The comedies, by American writers that I have seen, are
not remarkable for their wit or humor, and therefore do not long
retain their hold upon the stage. Dramatic exhibitions are not
however held by the Americans in very high estimation, and this
may be one of the causes of the low state of dramatic literature
here. But the principal causes would appear to be the want of
leisure, the devotion of the people to higher and more lucrative
avocations, and the facility with which dramatic productions of
established merit and popularity can be obtained from England.
These causes operate in like manner I conceive, to prevent the
attainment of that high poetical excellence which has yet to be
reached by the worshippers of the muse in this country. The
following remarks on this subject by an American writer are so
pertinent, that I will transcribe them for your information. "We regret
to say," says he, speaking of American poetry, "that much less has
been done than might reasonably have been expected, even during
our short political existence. We have indeed as yet scarcely done
anything at which an American can look with conscious pride, as a
trophy of native poetic genius. The ponderous and vapid Epic of
Barlow, and the still more leaden and senseless heroics of Emmons,
are far from giving reputation to the poetry of our country; and the
fugitive and occasional pieces of Percival, Bryant, Halleck, &c. are
not exactly such as we should select as a proof that we have done
much in poetry. We have been in existence as a nation for upwards
of half a century, and yet we have produced nothing that is certain
to reach posterity, or that can be classed higher than the minor
productions of Moore, Campbell, or Byron, of the present day. There
is an apparent want of originality, and too great an appearance of
imitation in the poetical efforts of our native bards to carry them far
down the stream of time, though it must be conceded that they
have discovered in these efforts no ordinary portion of genius. There
would seem to be something either in the nature of our political
institutions, or in the general character of our pursuits, which is
inimical to the developement of high poetical power. We are not a
very imaginative people; we prefer the reality to the ideal; we
pursue the substance rather than the shadow. Our ambition is early
fired by political distinction, or our exertions are directed to the
attainment of competency or wealth. The public mind has been led
into a train of thinking somewhat adverse to the indulgence of
poetical enthusiasm, and not calculated to render it susceptible of
deep and intense delight from the contemplation of poetical beauty.
It has been led to consider that the highest efforts of genius are
those which are displayed at the bar or in the senate, and to regard
the power of forensic and parliamentary eloquence as the loftiest
exhibition of intellectual excellence. To that which the mind is early
taught to respect and admire its greatest exertions will be directed,
and hence the number of those who resort to the profession of law,
the career of legislation, or the pursuits of commerce," &c.
Hooker in his Ecclesiastical Polity says, "The time will come when
three words, uttered with charity and meekness, shall receive a far
more blessed reward, than three thousand volumes written with
disdainful sharpness of wit."
TO ——.
PARAPHRASE
LINES.
Sleep on, thou dear maiden, I'll guard thee from harm,
No foe shall come nigh thee while strength's in this arm;
As thy sweet breath comes o'er me wild wishes may rise,
But honor still whispers—Remember the ties
Which bind her to one to whom she is dear
As his hopes of a heaven, she's all he has here.
Yes, far be it from me my friend to betray—
To gain thy affections, whilst he, far away,
But little suspects me, or dreams I would dare
To deceive his heart's treasure—so lovely, so fair:
Then sleep on, thou dear maiden, I'll guard thee from harm,
No foe shall come nigh thee while strength's in this arm.
J. M. C. D.
GRAYSON GRIFFITH.
In this village lived Gregory Griffith, the tanner, whose industry and
probity earned for him a respectability and an independence rivalled
by none except the old patriarch of the village, more generally
known by the name of the Major. Gregory had married the eldest
daughter of old farmer Ryefield, a woman well suited to make him
happy. Her disposition was easy, and her habits industrious and
economical. They were a bonny couple.
After breakfast, some of the neighbors called and inquired for the
welfare of the family. Some of the ladies kissed Grayson, as did his
mother, and he went to school. At play-time he told the children
what he had seen, and one of the older boys explained the matter to
the rest of the company. He said the old people loved fun, and also
played for money—and yet they would not let their boys play. "Never
mind," continued he, "I can make fun, if you will all beg some pins
and bring here to-morrow. Now, fellows, don't forget—bring a good
many." The next morning every mother and sister were faithfully
plied for pins, and every boy's sleeve was brightened with them.
Before the teacher had arrived, the elder boy, before named, had
taught all his juniors two ways of playing pins—one on a hat, and
the other called "heads or points." In a few days one boy had
secured all the pins, and kept them safely in a little case made of a
section of reed. The spirit of gambling, however, did not expire with
the loss of the pins. Indeed the loss of the many was the gain of
one, and that one was the object of profound admiration.
In a day or two, one of the boys came to school with an ear of white
and another of red corn, and a piece of chalk in his pocket, and
whispered to all his play fellows that now they would have fine fun.
Every urchin was restless for play-time. Grayson Griffith was sure the
master's watch must have stopped or must be too slow, and said so.
At length the hour of recreation came, and as soon as all were fairly
out of the teacher's hearing, the aforesaid boy prepared to teach his
fellows the game of fox and geese. With his chalk he chequered a
board, and arranged his white and red grains in proper order—
calling the white grains of corn geese, and the red foxes. Soon he
initiated every boy, and Grayson Griffith among the number, in the
mysteries of the game.
Ere long it was proposed that every boy should ask for a cent at
home, and bring it to school. It was done. Grayson Griffith asked for
one cent, and his father gave him two, and his mother one. They
said he was old enough to have pocket money. He was now nearly
eight years old. In the playtime, all the boys agreed to throw heads
or tails, until they had won or lost the money that could be had. At
the end of the sport, Grayson had seven cents—but on his way
home, he dropped one in the grass, and by throwing heads or tails
with another boy, he lost three more—so that at night he had no
more and no less than in the morning.
That evening he asked if his father would go to the race next day.
His father replied he did not know. "Well," said Grayson, "I bet you
three cents and my barlow knife against ninepence, that Colonel
Riley's Firefly will beat General Hobson's young Medley." "You will
bet?" said Mr. Griffith. "Why, yes," said Grayson, "did not you bet at
loo, father?" Grayson and his father, as by mutual consent, waived
the conversation.
Next day Grayson told at school what had occurred. Mr. Griffith did
not go to the races; but in the evening some of the gentlemen came
to see him, and induced him to bet as high as twenty dollars on a
game at loo. Grayson seemed hardly to notice the occurrence, yet
he was in reality closely observing, and caught several of the
expressions of the gentlemen visiters. The next day, at a game of
fox and geese, he cried "Damme soul." And as he went to school he
kept saying, "Clubs are trumps—high, low, jack and the game." He
thought it sounded pretty.
Mr. Griffith about this time gave a hundred dollars towards building a
church in the village, and subscribed twenty dollars a year towards
the minister's salary; and many of the people had become very
serious, and even religious. The good minister, like his master Jesus
Christ, was very fond of children. All the children knew him in six
weeks after he went to live in Goodcheer, and they all loved him.
They would speak to him all the way across the street. One day Mr.
Goodnews (for that was the minister's name) called at Mr. Griffith's,
and asked Grayson if he knew how many commandments there
were. His answer was, "I bet you I do." "But," said Mr. Goodnews, "I
never bet, my dear little boy. Did not you know it was wrong to
bet?" "No," said Grayson, "it is'nt—Father and mother bet." Mrs.
Griffith's face colored, and she stammered out, "My son, you ought
not to tell stories, even in fun. You will make dear Mr. Goodnews
think very badly of your parents." "Any how, mother, it is true," said
the boy.
When Grayson was sixteen years old, he read Hoyle on Games; and
though he understood very little of what he read, he conceived that
gaming must be a very profound science. Especially was this
impression deepened by hearing a member of congress say, that
Hoyle was as profound as Sir Isaac Newton. He read Hoyle again,
and even on the Sabbath. His parents began to suffer much
uneasiness about him; they sometimes wept over his case; they took
great pains to make religion appear amiable—but he was eager in
his pursuit of vanity.
In the course of time, young Griffith being twenty-one years old, left
his father's, with $700 and Decatur, to seek his fortune in the West.
He soon obtained employment, and in the course of two years was
able to commence business as partner in a new firm. But,
unfortunately, he was not satisfied in the village where he was, but
broke up and went to the town of Badblood, where he opened a
store. He was not long here until a quarrel commenced betwixt him
and one of his neighbors. The occasion of the quarrel was a
disagreement as to the beauty of a piece of music. One declared the
other to have a bad taste, and this was regarded as insulting. Of
course a challenge was given, and accepted. The day of combat
arrived. At the first fire no blood was spilt. This was owing to the
great agitation of both the combatants. At the second fire Griffith
wounded his antagonist slightly, but himself received no wound. At
the third fire Griffith's right arm was broken, and his antagonist was
wounded in the thigh. Here the seconds and friends interfered, and
declared they had fought enough. Had it not been for public opinion,
they would have thought that it was enough to be shot at once a
piece. But they were both content to quit, and even to drink each
other's health, before they left the ground. In the course of eight or
nine weeks, they were both in their usual health, and attending to
their accustomed duties.
G. GRIFFITH.
From this time Griffith wandered about, until, in the course of a few
months, he found himself again with his family. At first he seemed
pleased to kiss his babes and embrace his wife; but the next day
went to a faro bank in Badblood, and lost all he had—even his wife's
wardrobe and toilet. At this time he resolved on destroying his own
life. He went to three different shops, and procured laudanum in a
quantity sufficient to take life. He went home, and as he ascended
the first flight of stairs, he emptied the contents of each vial into his
stomach. O woman, what an angel of mercy thou art! His wife met
him at the door, with unwonted demonstrations of love. His little boy
prattled most sweetly; his little girl breathed in her crib as gently as
a May zephyr. His wife told him of several pleasant and smart things
which the children had said and done that day. He began to weep—
then to tremble—then to dislodge the contents of his stomach. "My
dear Nancy," said Griffith, "I shall be dead in a few hours, but never
mind." His wife perceiving that laudanum was in his stomach,
instantly prepared a potent emetic, and mixing it with a large
tumbler of hot water, offered it to her husband, and he consented to
drink it, supposing it could not be improper. In a few minutes,
through the influence of nausea, from the effects of brandy, and
from the dose just given, the stomach was emptied. Poor Griffith
suffered much, but gradually recovered. None save his wife knew of
the attempted violence on his own life.
Griffith and his wife both thought "how happy are they." They both
hastened home, as did Mrs. Felix also. Finding their boy much better,
and their kind hostess herself determining to remain at home in the
afternoon, both Mr. and Mrs. Griffith returned to the church. When
they came near the church they heard singing, and just as they
entered the door, the congregation sung, and repeated the closing
lines of a hymn as follows:
How astonished was he, when a few days after he formed this
purpose, as he was going to school in the morning, a gentleman
hailed him as Mr. Griffith, and said: "Sir, I won from you several
years ago nearly $700; there is the money, with some interest. I am
a christian. I cannot keep it; there it is." With these few words, the
traveller proceeded. Griffith was so amazed, that he even forgot to
ask his name, or residence, or the course of his journey. Of the
$700, Griffith sent $200 to the widow of a poor silly drunken man,
from whom he had, not long before his complete downfall, won that
amount. He sent $200 more to a young clerk, whom he had well
nigh ruined as to morals and character, and from whom he had won
$180 two years before. He sent $300 to the father of a little blind
girl, from whose deceased brother he had won that amount, saving
the interest, and requesting that it might be employed to send the
blind child to the Asylum for the blind. By the kindness of
Providence, other sums were restored to him, amounting in all to a
few hundreds. His economy and industry, and good capacity as a
teacher, also secured to him a growing income from his school—so
that in a few years he had paid every debt, and restored all money
obtained by gambling. He has since bought a small tract of land, and
built a very neat cabin, with two apartments, upon it. He calls it the
Retreat. He is now forty-three years old—still keeps a school—has a
good income from his own industry—enjoys tolerable health, and
has around him many of the comforts of life. His wife and children
still live, and help to make him happy. His penitence and humility are
deep; yet is thankfulness the reigning exercise of his heart. The
goodness and grace of God, through Jesus Christ, are themes on
which he never tires.
Dryden's genius was of that sort which catches fire by its own
motion; his chariot wheels got hot by driving fast.—Coleridge.
LINES
ebookbell.com