Foreword:
It is my pleasure to write a foreword for this book
“C Application Programs and Projects”.
It is well known that programming is a practice based
skill. The surest test of comprehension of programming
language concepts is the ability to apply them in various
problem solving applications. This book serves this
objective squarely. The features of C language
have been reviewed in brief and illustrated
with several programming examples. The concepts have
been sequenced in an increasing order of complexity,
as is appropriate. The coverage of C features
is extensive for someone who is interested
in acquiring proficiency in this language.
The description is lucid throughout which makes the
book useful as a self study resource. The large number
of programs provided are ready to use programs that
could also be adapted as building blocks for solving
new problems. This book meets the crying need of a supplementary
resource on C that deals with the experimental
aspects of this language. The exercises not only reinforce
the basic practical skills but also include challenging
assigments for the motivated reader. The programming
projects provide an opportunity to intregate the various
practical skills learnt and also illustrate the process
of design and implementation of scaled down real life
programs. Thebook is self contained and would be a useful
companion for a first course in C language
anywhere.
Dr Supratim Biswas
Professor
Computer Science and Engineering
Indian Institute of Technology, Bombay
About the Book:
The text matter of the ‘C’
programming is presented in four stages (16 units) of
this book. It covers the maxium number of features of
the languages including arrays, strings, functions,
pointers, storage classes, structures, unions dynamic
memory allocation, bit fields, linked lists, files,
graphics, in the appropriate sequence. The relevant
theory is mentioned at most places. The book is organized
in such a way as to be helpful for self-learning by
putting it on the desktop along with a personal computer.
Key features of the book:
•It covers a large number of areas and the basics,
thoroughly
•Understanding programming in C
by going through programs/examples
•Appropriate and challenging exercises at the end
of each lab session
•Design/implementation problems in the examples
and programming projects, which are to be developed
by the student
•Easy to read and informal style of writing
•Fine quality of text matter
Includes CD consisting of source code for Programs in
the book.
About the Authors: Dr. Dilip S. Mali
has been working as a lecturer in the Department of
Electronics, Shivaji University, Kolhapur for the last
seven years. He has been teaching computer languages
such as C, C++ to post-graduate students.
His research interests are digital signal processing,
communication and computer programming. He has published
papers in national/international journals and presented
papers at a number of conferences. He is a life member
of ISTE and IETE.
Dr. Pramod N. Vasambekar is currently working as a
reader in electronics in the Department of Electronics,
Shivaji University, Kolhapur. He has teaching and research
experience of twenty years. His topics of interest are
electronic materials, microwaves, communication electronics
and computer programming. He has taught computer languages
like BASIC, C and C++
to the M.Sc. students of electronics. He has published
several research papers in national/international journals
and presented papers at a number of conferences.
Contents
Unit No. Name of the
Unit
Unit 1 Fundamentals
of C
1.1 About ‘C’
1.2 Character set
1.3 Keywords
1.4 Identifiers
1.5 Data types
1.6 Constants
1.7 symbolic constants
1.8 Escape sequences
1.9 Variables
Exercises
Unit 2 Operators and
Expressions
2.1 Introduction
2.2 Arithmetic operators
2.3 Relational Operators
2.4 Logical Operators
2.5 Assignment Operators
2.6 Unary Operators
2.7 Conditional Operator
2.8 Bitwise Operators
2.9 Operator Precedence Groups
2.10 Type conversion in expressions
Exercises
Unit 3 Data Input/Output:
Data Types and Operators
Program
3.1 The ‘printf()’
function
3.2 The ‘scanf()’
function
3.3 The ‘getchar()’
and ‘putchar()’ functions
3.4 The ‘gets()’
and ‘puts()’ functions
3.5 The ‘enum’
data type
3.6 ‘typedef’
- user defined data type
3.7 sizeof() operator
3.8 Relational operators
3.10 Casting a value
Exercises
Unit 4 Formatting input
and output
Program
4.1 Formatting integer output
4.2 Formatting real number output
4.3 Formatting single character
output
4.4 Formatting string output
4.6 Formatting real number input
4.7 Formatting character and
string input
Exercises
Unit 5 Control structures
Branching
Program
5.A.1 Simple ‘if’
statement
5.A.2 The ‘if ….else’
statement
5.A.3 The nested ‘if
… else’ statement
5.A.4 The ‘else….if’
ladder
5.A.5 The ‘switch’
statement
5.A.6 The ‘conditional
operator’ (?:)
5.A.7 The ‘goto’
statement
Looping
Program
5.B.1 The ‘while’
loop
5.B.2 The ‘do…while’
loop
5.B.3 The ‘for’
loop
5.B.4 The ‘continue’
statement
Exercises
Unit 6 Arrays and Strings
Arrays
Program
6.A.1 Declaration of one dimensional
array
6.A.2 Initialization of one
dimensional array
6.A.3 Reordering an array in
ascending order
6.A.4 Declaration of two dimensional
array
6.A.5 Initialization of two
dimensional array
Strings
Program
6.B.1 Declaration and initialization
of a string
6.B.2 Reading string from keyboard
using the ‘getchar( )’ function
6.B.3 The function ‘atoi(
)’
6.B.4 The function ‘strcat(
)’
6.B.5 The function ‘strcmp(
)’
6.B.6 The function ‘strcpy(
)’
6.B.7 The function ‘strlen(
)’
6.B.8 Sorting strings in alphabetical
order
Exercises
Unit 7 Functions
Arithmetic functions
Program
7.A.1 The functions ‘abs(i)’
and ‘fabs(d)’
7.A.2 The functions ‘ceil(d)’
and ‘floor(d)’
7.A.3 The function ‘exp(d)’
7.A.4 The functions ‘log(d)’
and ‘log10(d)’
7.A.5 The functions ‘sin(d)’,
‘cos(d)’ and ‘tan(d)’
7.A.6 The function ‘sqrt(d)’.
User Defined functions
Program
7.B.1 Functions with no arguments
and no return values
7.B.2 Functions with arguments
and no return values
7.B.3 Functions with arguments
and return values
7.B.4 Function prototypes
7.B.5 Recursion
7.B.6 Passing an argument to
a function
7.B.7 Call by reference
7.b.8 Passing an array to a
function
Exercises
Programming project 1
Unit 8 Storage classes:
More about variables
8.1 Automatic storage class
8.2 Register storage class
8.3 Static storage class
8.4 External storage class
Program
8.1 Automatic storage class
8.2 Register storage class
8.3 Program without static storage
class
8.4 Static storage class
8.5 External storage class
Exercises
Unit 9 Pointers
Program
9.1 Declaration and initialization
of pointers
9.2 Pointer expressions
9.3 Accessing array elements
using the pointer
9.4 Accessing string characters
using the pointer
9.5 Pointers as function arguments
9.6 Passing an entire array
to a function
9.7 Using pointers to two dimensional
arrays
9.8 Arrays of pointers
9.9 Searching a string using
a ‘ragged array’
Exercises
Unit 10 Structures
and Unions
10.1 Structures
10.2 Unions
Structures
Program
10.A.1 Declaring and accessing
a ‘structure’
10.A.2 Initialization of ‘structure’
10.A.3 Arrays of structures
10.A.4 Arrays within structures
10.A.5 Structure within structure
10.A.6 Passing individual structure
elements to function
10.A.7 Passing an entire structure
variable to function
10.A.8 Structure pointers
Unions
Program
10.B.1 Referencing union members
10.B.2 Initializing a union
10.B.3 Sharing of the same
memory location
10.B.4 Comparing the size of
a union and a structure
10.B.5 The ‘little-endian’
format
Exercises
Programming project 2
Unit 11 Bitwise operators
and Bit fields
11.1 Bitwise Operators
11.2 Bit Fields
Program
11.1 Creating bit pattern of
given decimal number
11.2 One’s complement
operator
11.3 Logical bitwise operator
11.4 Shift operators
11.5 Bit fields
11.6 Overlapping bit fields
11.7 Unnamed bit fields
Exercises
Unit 12 Dynamic Memory
Management
Program
12.1 malloc() function
12.2 malloc() to store
a single byte
12.3 char malloc()
12.4 calloc() function
12.5 calloc() function
Exercises
Unit 13 Linked lists
13.1 Types of Linked Lists
13.2 Creation of a Linked List
13.3 Advantages of Linked Lists
13.4 Limitations of Linked Lists
Program
13.1 Creating a linked list
13.2 Inserting an item in the
linked list
Exercises
Programming project 3
Unit 14 Stream-oriented Data
files
14.1 Stream Oriented (Standard)
Data Files
14.2 System Oriented (Low Level)
Data Files
14.3 Opening and Closing a File
Program
14.1 Creating a data file to
write a character
14.2 Reading data file character
by character
14.3 Creating an integer data
file
14.4 Reading an integer data
file
14.5 Creating a data file containing
a string
14.6 Reading a data file containing
string
14.7 Creating a mixed data file
14.8 Reading a mixed data file
14.9 Updating a mixed data file
14.10 Copying a character from
one data file to another
14.11 Command line arguments
Exercises
Unit 15 Graphics
Graphics Routines
Program
15.A.1 The ‘putpixel(
)’, ‘line( )’ and ‘outtextxy(
)’ functions
15.A.2 The ‘rectangle(
)’ and ‘circle( )’ functions
15.A.3 The ‘ellipse(
)’ and ‘arc( )’ functions
15.A.4 The ‘setfillstyle(
)’, ‘bar( )’, ‘bar3d(
)’, ‘drawpoly( )’ and
fillpoly( )’ functions
‘
15.A.5 The ‘getmaxx(
)’, ‘getmaxy( )’, ‘moveto(
)’, ‘getx( )’ and
‘gety( )’ functions
15.A.6 The ‘setbkcolor(
)’, ‘setcolor( )’, ‘getbkcolor(
)’ and ‘getcolor( )’
functions
15.A.7 The ‘imagesize(
)’, ‘getimage( )’ and
‘putimage( )’ functions
15.A.8 Creating buttons, bars
and boxes
Using the mouse
Program
15.B.1 Initializing and showing
the mouse pointer
15.B.2 Setting horizontal and
vertical limits for mouse pointer
15.B.3 Getting the mouse position
and mouse button status
15.B.4 Drawing with the mouse
15.B.5 Shooting button with
the mouse
Exercises
Programming Project 4
Unit 16 Solved Problems
Program
16.1 Fibonacci numbers
16.2 Gain and beamwidth of a
parabolic reflector
16.3 Roots of quadratic equation
16.4 Characteristic impedance
of a transmission line
16.5 Surface resistance and
microwave loss of gold-film
16.6 Transmission path distance
for a satellite
16.7 Amplitude modulation
16.8 The characteristic impedance
(Zo) of a coaxial cable (using conductor dimensions)
16.9 Cut-off frequency, phase
velocity and guide wavelength for a rectangular
waveguide
16.10 Range of errors
16.11 Standard deviation
16.12 Maximum range for tropospheric
transmission
16.13 Angle of inclination
of satellite orbit due to latitude deviation
16.14 Conversion of mW power
to dBm scale
16.15 Compound interest
16.16 Design of coils in resonant
or tuning circuit
16.17 Frequency of oscillation
of 3-section phase shift oscillator
16.18 Verification of truth
table of AND, OR and XOR gates
16.19 Creating a list of laboratory
equipment
16.20 Drawing a parabola
16.21 Radiation pattern of
Yagi antenna
16.22 Design and simulation
of a discrete time filters
References
Index
|