C Programming For Dummies

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Get an A grade in C As with any major language, mastery of C can take you to some very interesting new places. Almost 50 years after it first appeared, it's still the world's most popular programming language and is used as the basis of global industry's core systems, including operating systems, high-performance graphics applications, and microcontrollers. This means that fluent C users are in big demand at the sharp end in cutting-edge industries―such as gaming, app development, telecommunications, engineering, and even animation―to translate innovative ideas into a smoothly functioning reality. To help you get to where you want to go with C, this 2nd edition of C Programming For Dummies covers everything you need to begin writing programs, guiding you logically through the development cycle: from initial design and testing to deployment and live iteration. By the end you'll be au fait with the do's and don'ts of good clean writing and easily able to produce the basic―and not-so-basic―building blocks of an elegant and efficient source code. • Write and compile source code • Link code to create the executable program • Debug and optimize your code • Avoid common mistakes Whatever your destination: tech industry, start-up, or just developing for pleasure at home, this easy-to-follow, informative, and entertaining guide to the C programming language is the fastest and friendliest way to get there!

Author(s): Dan Gookin
Series: For Dummies
Edition: 2
Publisher: Wiley
Year: 2020

Language: English
Commentary: Vector PDF
Pages: 464
City: Hoboken, NJ
Tags: Programming; C; Elementary

Title Page
Copyright Page
Table of Contents
Introduction
Why the C Language?
The C Programming For Dummies Approach
How This Book Works
Icons Used in This Book
Parting Thoughts
Part 1 The ABs of C
Chapter 1 A Quick Start for the Impatient
What You Need to Program
Command Prompt Programming
IDE Programming
Installing Code::Blocks
Touring the Code::Blocks workspace
Your First Program
Coding at the command prompt
Building a new Code::Blocks project
Building and running
Chapter 2 The Programming Thing
The History of Programming
Reviewing early programming history
Introducing the C language
The Programming Process
Understanding programming
Writing source code
Compiling and linking
Running and testing
Chapter 3 Anatomy of C
Parts of the C Language
Keywords
Functions
Operators
Variables and values
Statements and structure
Comments
Behold the Typical C Program
Understanding C program structure
Setting the main() function
Returning something to the operating system
Adding a function
Part 2 C Programming 101
Chapter 4 Trials and Errors
Display Stuff on the Screen
Displaying a humorous message
Introducing the puts() function
Adding more text
Commenting out a statement
Goofing up on purpose
More Text Output Nonsense
Displaying text with printf()
Introducing the printf() function
Understanding the newline
Employing escape sequences
Goofing up on purpose again
Chapter 5 Values and Simple Math
A Venue for Various Values
Understanding values
Displaying values with printf()
Minding the extra zeros
The Computer Does the Math
Doing simple arithmetic
Reviewing the float-integer thing
Pretending integers are floats
Chapter 6 A Place to Put Stuff
Values That Vary
Setting up a quick example
Introducing data types
Using variables
Variable Madness!
Using more-specific data types
Working with several variables
Assigning a value upon creation
Reusing variables
Constants Always the Same
Using the same value over and over
Constants in your code
Putting constants to use
Chapter 7 Input and Output
Character I/O
Understanding input and output devices
Fetching characters with getchar()
Using the putchar() function
Working with character variables
Text I/O, but Mostly I
Storing strings
Introducing the scanf() function
Reading a string with scanf()
Reading values with scanf()
Using fgets() for text input
Chapter 8 Decision Making
What If?
Making a simple comparison
Introducing the if keyword
Comparing values in various ways
Knowing the difference between = and ==
Forgetting where to put the semicolon
Multiple Decisions
Making more-complex decisions
Adding a third option
Multiple Comparisons with Logic
Building a logical comparison
Adding some logical operators
The Old Switch Case Trick
Making a multiple-choice selection
Understanding the switch-case structure
Taking no breaks
The Weird ?: Decision Thing
Chapter 9 Loops, Loops, Loops
A Little Déjà Vu
The Thrill of for Loops
Doing something x number of times
Introducing the for loop
Counting with the for statement
Looping letters
Nesting for loops
The Joy of the while Loop
Structuring a while loop
Using the do while loop
Loopy Stuff
Looping endlessly
Looping endlessly but on purpose
Breaking out of a loop
Adding multiple for loop conditions
Screwing up a loop
Chapter 10 Fun with Functions
Anatomy of a Function
Constructing a function
Prototyping (or not)
Functions and Variables
Using variables in functions
Sending a value to a function
Sending multiple values to a function
Creating functions that return values
Returning early
Constants of the Global Kind
Introducing defined constants
Putting defined constants to use
Part 3 Build Upon What You Know
Chapter 11 The Unavoidable Math Chapter
Math Operators from Beyond Infinity
Incrementing and decrementing
Prefixing the ++ and -- operators
Discovering the remainder (modulus)
Saving time with assignment operators
Math Function Mania
Exploring some common math functions
Suffering through trigonometry
It’s Totally Random
Spewing random numbers
Making the numbers more random
The Holy Order of Precedence
Getting the order correct
Forcing order with parentheses
Chapter 12 Give Me Arrays
Behold the Array
Avoiding arrays
Understanding arrays
Initializing an array
Playing with character arrays (strings)
Working with empty char arrays
Sorting arrays
Multidimensional Arrays
Making a two-dimensional array
Going crazy with three-dimensional arrays
Declaring an initialized multidimensional array
Arrays and Functions
Passing an array to a function
Returning an array from a function
Chapter 13 Fun with Text
Character Manipulation Functions
Introducing the CTYPEs
Testing characters
Changing characters
String Functions Galore
Reviewing string functions
Comparing text
Building strings
Fun with printf() Formatting
Formatting floating point
Setting the output width
Aligning output
Gently Down the Stream
Demonstrating stream input
Dealing with stream input
Chapter 14 Structures, the Multivariable
Hello, Structure
Introducing the multivariable
Understanding struct
Filling a structure
Making an array of structures
Weird Structure Concepts
Putting structures within structures
Passing a structure to a function
Chapter 15 Life at the Command Prompt
Conjure a Terminal Window
Starting a terminal window
Running code in text mode
Arguments for the main() Function
Reading the command line
Understanding main()’s arguments
Time to Bail
Quitting the program
Running another program
Chapter 16 Variable Nonsense
Variable Control
Typecasting into disbelief
Creating new things with typedef
Making static variables
Variables, Variables Everywhere
Using external variables
Creating an external structure variable
Enumerating
Chapter 17 Binary Mania
Binary Basics
Understanding binary
Outputting binary values
Bit Manipulation
Using the bitwise | operator
Using bitwise &
Operating exclusively with XOR
Understanding the ~ and ! operators
Shifting binary values
Explaining the binbin() function
The Joy of Hex
Part 4 The Advanced Part
Chapter 18 Introduction to Pointers
The Biggest Problem with Pointers
Sizing Up Variable Storage
Understanding variable storage
Reading a variable’s size
Checking a variable’s location
Reviewing variable storage info
The Hideously Complex Topic of Pointers
Introducing the pointer
Working with pointers
Chapter 19 Deep into Pointer Land
Pointers and Arrays
Getting the address of an array
Working pointer math in an array
Substituting pointers for array notation
Strings Are Pointer-Things
Using pointers to display a string
Using a pointer to declare a string
Building an array of pointers
Sorting strings
Pointers in Functions
Passing a pointer to a function
Returning a pointer from a function
Chapter 20 Memory Chunks and Linked Lists
Give Me Memory!
Introducing the malloc() function
Creating string storage
Using the calloc() function
Getting more memory
Freeing memory
Lists That Link
Allocating space for a structure
Creating a linked list
Editing a linked list
Saving a linked list
Chapter 21 It’s About Time
What Time Is It?
Understanding the calendar
Working with time in C
Time to Program
Checking the clock
Viewing a timestamp
Slicing through the time string
Snoozing
Part 5 And the Rest of It
Chapter 22 Permanent Storage Functions
Sequential File Access
Understanding C file access
Writing text to a file
Reading text from a file
Appending text to a file
Writing binary data
Reading binary data
Random File Access
Writing a structure to a file
Reading and rewinding
Finding a specific record
Saving a linked list to a file
Chapter 23 File Management
Directory Madness
Calling up a directory
Gathering more file info
Separating files from directories
Exploring the directory tree
Fun with Files
Renaming a file
Copying a file
Deleting a file
Chapter 24 Beyond Mere Mortal Projects
The Multi-Module Monster
Linking two source code files
Sharing variables between modules
Creating a custom header file
Other Libraries to Link
Chapter 25 Out, Bugs!
Simple Tricks to Resolve Problems
Documenting the flow
Talking through your code
Writing comments for future-you
The Debugger
Debugging setup
Working the debugger
Setting a breakpoint
Watching variables
Improved Error Messages
Part 6 The Part of Tens
Chapter 26 Ten Common Boo-Boos
Conditional Foul-Ups
== v. =
Dangerous Loop Semicolons
Commas in for Loops
Missing break in a switch Structure
Missing Parentheses and Curly Brackets
Don’t Ignore a Warning
Endless Loops
scanf() Blunders
Streaming Input Restrictions
Chapter 27 Ten Reminders and Suggestions
Maintain Good Posture
Use Creative Names
Write a Function
Work on Your Code a Little Bit at a Time
Break Apart Larger Projects into Several Modules
Know What a Pointer Is
Add Whitespace before Condensing
Know When if-else Becomes switch-case
Remember Assignment Operators
When You Get Stuck, Read Your Code Out Loud
Part 7 Appendices
Appendix A ASCII Codes
Appendix B Keywords
Appendix C Operators
Appendix D Data Types
Appendix E Escape Sequences
Appendix F Conversion Characters
Appendix G Order of Precedence
Index
EULA