Solve your C programming problems with practical and informative recipes. This book covers various aspects of C programming including the fundamentals of C, operators and expressions, control statements, recursion, and user-defined functions. Each chapter contains a series of recipes that you can easily reference to quickly find the answers you are looking for.
C Recipes also contains recipes and solutions for problems in memory management, arrays, standard input and output, structures and unions, pointers, self-referential structures, data files, pre-processor directives, and library functions.
What You Will Learn
Master operators and expressions
Write user-defined functions
Work with structures and unions
Define self referential structures
Leverage library functions
Who This Book Is For
Those with some experience in C programming.
Shirish Chavan is a writer, a teacher, a software consultant, a scientist, and an orator. He did M.Sc. in Theoretical Physics from Shivaji University, Kolhapur in 1982. He has been teaching Physics and Computer Science in various colleges since past thirty years. As an orator he has delivered hundreds of speeches on various subjects. As a scientist, he is having one discovery and two inventions to his credit. As a writer his eight books are published by reputed publishers and three of them were bestsellers in India for a limited period.
Chapter 1: Welcome to C Chapter Goal: To teach the basics of computer programming and to develop the first program in C. No of pages: 20 Sub - Topics Brief History of C Programs, Software, and Operating System Machine Language and Assembly Language Procedural Languages Object-Oriented Languages Terminology in Computers Actual Machine and Virtual Machine Compiled and Interpreted Languages Our Very First C Program Next Couple of Programs C is Free Form Language Escape Sequences Salient Features of C Compile-Time and Run-Time Environments
Chapter 2: Fundamentals of C Chapter Goal: To teach the fundamentals of C. No of pages: 35 Sub - Topics C Character Set Keywords Tokens User-Defined Identifiers Variables and Function printf ( ) Basic, Primary, or Fundamental Data Types Hexadecimal, Decimal, Octal, and Binary Systems of Numbers Basic or Primary Constants Using Variables Chain of Assignmets Symbolic Constants Interactive Programs Implicit and Explicit Type Conversion Operator sizeof
Chapter 3: Operators and ExpressionsChapter Goal: To teach the use of operators and expressions in C programming. No of pages : 35 Sub - Topics: Operators Arithmetic Operators Precedence (Priority) and Associativity of Operators Relational and Equality Operators Logical Operators Increment and Decrement Operators Bitwise Operators Assignment Operators Ternary Operator ? : Concept of Computer-Control and Flowchart Activity Diagrams Program Design Language (PDL) Expressions and Statements Data Type Enumeration
Chapter 4: Control StatementsChapter Goal: To teach the use of control statements in C programming. No of pages: 35 Sub - Topics: Types of Statements Classification of Control Statements Selection Statement if-else Nested if-else Statements else-if Ladder Labels and goto Statement Selection Statement switch Iteration Statement while Using continue Statement Using break Statement Beware of Infinite Loops Iteration Statement do-while Iteration Statement for Nesting of Loops Computing Area and Perimeter of Circle Simple Programs
Chapter 5: User-Defined FunctionsChapter Goal: To teach the use of User-Defined Functions in C programming. No of pages: 35 Sub - Topics: What is this Function? Using Function Prototype Experimenting with Functions Function Returning a Value Passing Arguments by Value A Short Introduction to Pointers Passing the Arguments by Reference or Passing the Pointers Chain of Function-Calls Using return Statement Recursion Creating a Multi-File Program Storage Classes Storage Classes and Functions
Chapter 6: Arrays Chapter Goal: To teach the use of arrays in C programming. No of pages: 35 Sub - Topics: Derived Types Welcome to Arrays One Dimensional Arrays One-Dimensional Array and String Constants Bounds Checking Passing Array to Function as Argument Multi-Dimensional Arrays Arrays and Memory
Chapter 7: Standard Input and Output Chapter Goal: To teach how to handle input and output in C. No of pages: 35 Sub - Topics: Primer Function getchar ( ) Function putchar ( ) Function gets ( ) Function puts ( ) Function scanf ( ) for Input from Keyboard Function printf ( ) for Output to Monitor
Chapter 8: Structures and Unions Chapter Goal: To teach the use of structures and unions in C. No of pages: 35 Sub - Topics: Welcome to Structures Nesting of Structures Array of Structures Pointers to Strctures Structures and Functions Using typedef to Create Aliases for Types Unions Bit-Fields
Chapter 9: Pointers Chapter Goal: To teach the use of pointers in C. No of pages: 35 Sub - Topics: Pointers and One-Dimensional Arrays Scaling in Pointer Arithmetic Valid Pointer Operations Pointers and Strings Pointers and Two-Dimensional Arrays Pointer to an Array Two-Dimensional Arrays Revisited Array of Pointers Two-Dimensional Character Arrays and Pointers Array of Pointers-to-Strings Array of Pointers-to-Strings and malloc ( ) Function Command-Line Arguments Function Returning Pointer Pointers to Functions Pointers to Pointers Few Examples of Pointer Declarations Data Type void and Pointer to void
Chapter 10: Self Referential Structures Chapter Goal: To teach the use of self referential structures in C. No of pages: 35 Sub - Topics: Dynamic Memory Allocation Welcome to Self Referential Structures Welcome to Linear Linked Lists Creating a Linked List Using Anonymous Variables Deleting a Component in the Linked List Inserting a Component in the Linked List Creating a Linked List in an Interactive Session Professional Program to Process a Linear Linked List Linear Linked Lists with Forward and Backward Traversing Circular Lists Trees
Chapter 11: Data Files Chapter Goal: To teach how to handle the data files in C. No of pages: 35 Sub - Topics: Reading a File Using the Function fgetc ( ) If File Opening Fails Writing to a File Using the Function fputs ( ) Reading a File Using the Function fgets ( ) Writing to a File Using the Function fputc ( ) Writing to a File Using the Function fprintf ( ) Reading a File Using the Function fscanf ( ) Text Files and Binary Files Writing to a File Using the Function fwrite ( ) Reading a File Using the Function fread ( ) Renaming a File and Deleting a File Copying a Text File Copying a Binary File Using the Function rewind ( ) Using the Functions fseek ( ) and ftell ( ) File Opening Modes C's Model of a File Composition of Type FILE
Chapter 12: Preprocessor Directives Chapter Goal: To teach how to use preprocessor directives in C. No of pages: 35 Sub - Topics: What is Preprocessor? File Inclusion Directives Macro Expansion Directives Macro Expansion Directives With Arguments Conditional Compilation Directives Miscellaneous Directives Directive Operators Predefined Macros
Chapter 13: Library Functions Chapter Goal: To teach how to use library functions in C. No of pages: 20 Sub - Topics: Character Testing Functions String Processing Functions Mathematical Functions Utility Functions