ANSI C Programming
357 pages
English

Vous pourrez modifier la taille du texte de cet ouvrage

Découvre YouScribe en t'inscrivant gratuitement

Je m'inscris

Découvre YouScribe en t'inscrivant gratuitement

Je m'inscris
Obtenez un accès à la bibliothèque pour le consulter en ligne
En savoir plus
357 pages
English

Vous pourrez modifier la taille du texte de cet ouvrage

Obtenez un accès à la bibliothèque pour le consulter en ligne
En savoir plus

Description

Learn real-world C programming as per the latest ANSI standard Key features Learn real-world C programming as per the latest ANSI standard All programs work on DOS, Windows as well as Linux Detailed explanation of difficult concepts like "Pointers" and "Bitwise operators" End of chapter exercises drawn from different universities Written by best-selling author of Let Us CDescriptionIn this heterogeneous world a program that is compiler dependent is simply unacceptable. ANSI C Programming teaches you C language in such a manner that you are able to write truly portable programs. This book doesn't assume any programming background. It begins with the basics and steadily builds the pace so that the reader finds it easy to handle complicated topics towards the end. Each chapter has been designed to create a deep and lasting impression on the reader's mind. "If taught through examples, any concept becomes easy to gasp". This book follows this dictum faithfully, Yashavant has crafted well thought out programming examples for every aspects of C programming. What will you learn Algorithms, control instructions, strings, bitwise operators, flowcharts, functions Structures, enumerations, data types, pointers, unions, dynamic memory allocation Storage classes, arrays, File IO, linked list Who this book is forStudents, Programmers, researchers, and software developers who wish to learn the basics of ANSI C Programming. Table of contents1. Before We Begin2. Introduction To Programming3. Algorithms For Problem Solving4. Introduction To C Language5. The Decision Control Structure6. The Loop Control Structure7. The Case Control Structure8. Functions & Pointers9. Data Types Revisited10. The C Preprocessor10. Arrays11. Puppetting On Strings12. Structures13. Self Referential Structures and Linked Lists14. Console Input/Output15. File Input/Output16. More Issues In Input/Output17. Operations On Bits18. Miscellaneous FeaturesAppendix A - Precedence TableAppendix B - Chasing the BugsAppendix C - ASCII ChartIndex About the authorYashavant Kanetkar's programming books have almost become a legend. Through his original works in the form of books and Quest Video courseware CDs on C, C++, Data Structures, VC++, .NET, Embedded Systems, etc. Yashavant Kanetkar has created, moulded and groomed lacs of IT careers in the last decade and half. In recognition of his immense contribution to IT education in India, he has been awarded the "Best .NET Technical Contributor" and "Most Valuable Professional" awards byMicrosoft. His current passion includes Device Driver and Embedded System Programming. Yashavant has recently been honored with a "Distinguished Alumnus Award" by IIT Kanpur for his entrepreneurial, professional and academic excellence. Yashavant holds a BE from VJTI Mumbai and M.Tech. from IIT Kanpur. Yashavant'scurrent affiliations include being a Director of KICIT and KSET. His Linkedin profile: linkedin.com/in/yashavant-kanetkar-9775255

Sujets

Informations

Publié par
Date de parution 04 novembre 2019
Nombre de lectures 1
EAN13 9789389423013
Langue English
Poids de l'ouvrage 1 Mo

Informations légales : prix de location à la page 0,0600€. Cette information est donnée uniquement à titre indicatif conformément à la législation en vigueur.

Extrait

ANSI C Programming
Yashavant P. Kanetkar
FIRST EDITION 2019
Copyright © BPB Publications, INDIA
ISBN: 978-93-89423-00-6
All Rights Reserved. No part of this publication can be stored in a retrieval system or reproduced in any form or by any means without the prior written permission of the publishers.
LIMITS OF LIABILITY AND DISCLAIMER OF WARRANTY
The Author and Publisher of this book have tried their best to ensure that the programmes, procedures and functions described in the book are correct. However, the author and the publishers make no warranty of any kind, expressed or implied, with regard to these programmes or the documentation contained in the book. The author and publisher shall not be liable in any event of any damages, incidental or consequential, in connection with, or arising out of the furnishing, performance or use of these programmes, procedures and functions. Product name mentioned are used for identification purposes only and may be trademarks of their respective companies.
All trademarks referred to in the book are acknowledged as properties of their respective owners.
Distributors:
BPB PUBLICATIONS
20, Ansari Road, Darya Ganj
New Delhi-110002
Ph: 23254990/23254991
BPB BOOK CENTRE
376 Old Lajpat Rai Market,
Delhi-110006
Ph: 23861747
MICRO MEDIA
Shop No. 5, Mahendra Chambers,
150 DN Rd. Next toCapital Cinema,
V.T. (C.S.T.) Station, MUMBAI-400 001
Ph: 22078296/22078297
DECCAN AGENCIES
4-3-329, Bank Street,
Hyderabad-500195
Ph: 24756967/24756400
Published by Manish Jain for BPB Publications, 20, Ansari Road, Darya Ganj, New Delhi-110002 and Printed by Repro India Pvt Ltd, Mumbai
Dedicated to baba
Who couldn’t be here to see this day…
About the Author
Through his original works in the form of books and Quest Video courseware CDs on C, C++, Data Structures, VC++, .NET, Embedded Systems, etc. Yashavant Kanetkar has created, moulded and groomed lacs of IT careers in the last decade and half. In recognition of his immense contribution to IT education in India, he has been awarded the Best .NET Technical Contributor and Most Valuable Professional awards by Microsoft. His current passion includes Device Driver and Embedded System Programming. Yashavant has recently been honored with a “Distinguished Alumnus Award” by IIT Kanpur for his entrepreneurial, professional and academic excellence. Yashavant holds a BE from VJTI Mumbai and M.Tech. from IIT Kanpur. Yashavant’s current affiliations include being a Director of KICIT and KSET.
Acknowledgments
Once I completed my first book, fifteen years ago, one person has continuously egged me on to write on newer and newer topics. He is Manish Jain of BPB. He has a way to motivate authors to produce better books. I hope every author gets a publisher who is as cooperative, knowledgeable and supportive as Manish.
I thank Seema, my wife, my parents and kids for supporting me throughout this book effort.
And finally my heartfelt gratitude to Monali Mohadikar for the countless hours she spent on formatting the text and the figures to make them appear just the way I wanted them to.
Preface
Writing C programs targeted for one compiler is one thing, but making the programs work under all compilers is what makes it portable and useful. In this heterogeneous world a program which is compiler dependant is simply unacceptable. In ANSI C programming I have attempted to teach C language in such a manner that you are able to write truly portable programs.
If you feel that I could have done certain things in this book better than what I have, or you have any suggestions about what you would like to see in the next edition, please drop a line to sales@bpbonline.com
All the best and happy programming!
Contents
0. Before We Begin
Detailed Compilation Steps
Compilation using TC / TC++
Problem of TC with Windows Vista / Windows 7
Compilation using Visual Studio / Visual Studio Exp
Compilation using gcc
A Word of Caution
1. Introduction To Programming
Basic Model of Computation
Algorithms
Flowchart
Programming Languages
Stages in the Development of a C Program
Developing the Program
Compiling the Program
Linking the Program
Testing the Program
Documenting the Program
Summary
Exercise
2. Algorithms For Problem Solving
Exchanging values of two variables
Summation of a set of numbers
Decimal to Binary Conversion
Reversing digits of an integer
GCD of two numbers
Testing whether a number is prime
Organizing numbers in ascending order
Square root of a number
Factorial computation
Evaluation of ‘sin x’
Fibonacci sequence
Reversal of array elements
Finding largest number in an array
Printing elements of upper triangular matrix
Multiplication of two matrices
Exercise
3. Introduction To C Language
What is C
What is ANSI C
Getting Started with C
The C Character Set
Constants, Variables and Keywords
Types of C Constants
Rules for Constructing Integer Constants
Rules for Constructing Real Constants
Rules for Constructing Character Constants
Types of C Variables
Rules for Constructing Variable Names
C Keywords
The First C Program
Compilation and Execution
Receiving Input
C Instructions
Type Declaration Instruction
Arithmetic Instruction
Integer and Float Conversions
Hierarchy of Operations
Associativity Of Operators
Control Instruction in C
Summary
Exercise
4. The Decision Control Structure
Decisions! Decisions!
The if Statement
The Real Thing
Multiple Statements within if
The if-else Statement
Nested if-elses
Forms of if
Use of Logical Operators
The else if Clause
The ! Operator
Hierarchy of Operators Revisited
A Word of Caution
The Conditional Operators
Summary
Exercise
5. The Loop Control Structure
Loops
The while Loop
Tips and Traps
More Operators
The for Loop
Nesting of Loops
Multiple Initialisations in the for Loop
The Odd Loop
The break Statement
The continue Statement
The do-while Loop
Summary
Exercise
6. The Case Control Structure
Decisions Using switch
The Tips and Traps
switch Versus if-else Ladder
The goto Keyword
Summary
Exercise
7. Functions & Pointers
What is a Function
Why Use Functions
Passing Values between Functions
Scope Rule of Functions
Calling Convention
One Dicey Issue
Advanced Features of Functions
Return Type of Function
Call by Value and Call by Reference
An Introduction to Pointers
Pointer Notation
Back to Function Calls
Conclusions
Recursion
Recursion and Stack
Adding Functions to the Library
Summary
Exercise
8. Data Types Revisited
Integers, long and short
Integers, signed and unsigned
Chars, signed and unsigned
Floats and Doubles
A Few More Issues…
Storage Classes in C
Automatic Storage Class
Register Storage Class
Static Storage Class
External Storage Class
A Few Subtle Issues
Which to Use When
Summary
Exercise
9. The C Preprocessor
Features of C Preprocessor
Macro Expansion
Macros with Arguments
Macros versus Functions
File Inclusion
Conditional Compilation
#if and #elif Directives
Miscellaneous Directives
#undef Directive
#pragma Directive
The Build Process
Preprocessing
Compilation
Assembling
Linking
Loading
Summary
Exercise
10. Arrays
What are Arrays
A Simple Program Using Array
More on Arrays
Array Initialization
Bounds Checking
Passing Array Elements to a Function
Pointers and Arrays
Passing an Entire Array to a Function
The Real Thing
Two Dimensional Arrays
Initializing a 2-Dimensional Array
Memory Map of a 2-Dimensional Array
Pointers and 2-Dimensional Arrays
Pointer to an Array
Passing 2-D array to a Function
Array of Pointers
Three Dimensional Array
Summary
Exercise
11. Puppetting On Strings
What are Strings
More about Strings
Pointers and Strings
Standard Library String Functions
strlen( )
strcpy( )
strcat( )
strcmp( )
Two-Dimensional Array of Characters
Array of Pointers to Strings
Limitation of Array of Pointers to Strings
Solution
Summary
Exercise
12. Structures
Why Use Structures
Declaring a Structure
Accessing Structure Elements
How Structure Elements are Stored
Array of Structures
Additional Features of Structures
Uses of Structures
Summary
Exercise
13. Self Referential Structures and Linked Lists
What is a Linked List
Self-referential Structures
Operations on a Linked List
Summary
Exercise
14. Console Input/Output
Types of I/O
Console I/O Functions
Formatted Console I/O Functions
sprintf( ) and sscanf( ) Functions
Unformatted Console I/O Functions
Summary
Exercise
15. File Input/Output
Data Organization
File Operations
Opening a File
Reading from a File
Trouble in Opening a File
Closing the File
Counting Characters, Tabs, Spaces, …
A File-copy Program
Writing to a File
File Opening Modes
String (line) I/O in Files
The Awkward Newline
Record I/O in Files
Text Files and Binary Files
Record I/O Revisited
Database Management
Low Level Disk I/O
A Low Level File-copy Program
I/O Under Windows
Summary
Exercise
16. More Issues In Input/Output
Using argc and argv
Detecting Errors in Reading/Writing
Standard I/O Devices
I/O Redirection
Redirecting the Output
Redirecting the Input
Both Ways at Once
Summary
Exercise
17. Operations On Bits
Bitwise Operators
One’s Complement Operator
Right Shift Operator
Left Shift Operator
Bitwise AND Operator
Bitwise OR Operator
Bitwise XOR Operator
The showbits( ) Function
Hexadecimal Numbering System
Relationship between Binary and Hex
Summary
Exercise
18. Miscellaneous Features
Enumerated Data Type
Uses of Enumerated Data Type
Are Enums Necessary
Renaming Data Types with typedef
Typecasting
Bit Fields
Pointers to Functions
Functions Returning Pointers
Func

  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents